Пример #1
0
def _init_run_attrs(run, op, flags, opts):
    opref = opreflib.OpRef("func", "", "", "", op.__name__)
    run.write_opref(opref)
    run.write_attr("started", runlib.timestamp())
    run.write_attr("flags", flags)
    if "label" in opts:
        run.write_attr("label", opts["label"])
Пример #2
0
def _init_run_attrs(run, op, flag_vals, opts, extra_attrs):
    opref = opreflib.OpRef("func", "", "", "", _op_name(op, opts))
    run.write_opref(opref)
    run.write_attr("started", runlib.timestamp())
    run.write_attr("flags", flag_vals)
    run.write_attr("label", _run_label(flag_vals, opts))
    if extra_attrs:
        for name, val in extra_attrs.items():
            run.write_attr(name, val)
Пример #3
0
def _op_finalize_run_attrs(run, exit_status):
    if not os.path.exists(run.dir):
        log.warning("run directory has been deleted, unable to finalize")
        return
    if not os.path.exists(run.guild_path()):
        log.warning("run Guild directory has been deleted, unable to finalize")
        return
    stopped = runlib.timestamp()
    run.write_attr("exit_status", exit_status)
    run.write_attr("stopped", stopped)
    op_util.delete_proc_lock(run)
Пример #4
0
 def _init_trial_run(self, run_dir=None):
     assert isinstance(self.flags, dict), self.flags
     run_dir = run_dir or os.path.join(var.runs_dir(), self.run_id)
     run = runlib.Run(self.run_id, run_dir)
     if run.get("batch") != self.batch.batch_run.id:
         util.copytree(self.batch.proto_run.path, run_dir)
         for name, val in self.attrs.items():
             run.write_attr(name, val)
         run.write_attr("initialized", runlib.timestamp())
         run.write_attr("flags", self.flags)
         run.write_attr("batch", self.batch.batch_run.id)
     return run
Пример #5
0
def set_run_started(run):
    started = runlib.timestamp()
    run.write_attr("started", started)
Пример #6
0
def _finalize_run(run, exit_status):
    run.write_attr("exit_status", exit_status)
    run.write_attr("stopped", runlib.timestamp())
    op_util.delete_proc_lock(run)
Пример #7
0
def _finalize_run_attrs(run, exit_status):
    run.write_attr("exit_status", exit_status)
    run.write_attr("stopped", runlib.timestamp())