Beispiel #1
0
def _run(run, op, quiet, stop_after, extra_env):
    try:
        _resolve_deps(op, run)
    finally:
        op_util.clear_run_pending(run)
    op_util.set_run_started(run)
    op_util.clear_run_marker(run, "STAGED")
    proc = _op_start_proc(op, run, extra_env)
    exit_status = _op_wait_for_proc(op, proc, run, quiet, stop_after)
    _op_finalize_run_attrs(run, exit_status)
    return exit_status
Beispiel #2
0
def run(op, quiet=False, pidfile=None, stop_after=None, extra_env=None):
    run = init_run(op)
    op_util.clear_run_marker(run, "STAGED")
    try:
        _resolve_deps(op, run)
    finally:
        op_util.clear_run_pending(run)
    op_util.set_run_started(run)
    if pidfile:
        _run_op_in_background(run, op, pidfile, quiet, stop_after, extra_env)
        return run, 0
    else:
        exit_status = _run_op(run, op, quiet, stop_after, extra_env)
        return run, exit_status
Beispiel #3
0
def init_trial_run(batch_run, trial_flag_vals, run_dir=None):
    run = op_util.init_run(run_dir)
    _link_to_trial(batch_run, run)
    proto_run = batch_run.batch_proto
    assert proto_run, "proto_run not initialized for batch %s (%s)" % (
        batch_run.id,
        batch_run.dir,
    )
    util.copytree(proto_run.dir, run.dir)
    run.write_attr("flags", trial_flag_vals)
    run.write_attr("label", _trial_label(proto_run, trial_flag_vals))
    run.write_attr("op", _trial_op_attr(proto_run, trial_flag_vals))
    op_util.set_run_pending(run)
    op_util.set_run_started(run)
    return run