Ejemplo n.º 1
0
def _op_start_proc(op, run, quiet, extra_env):
    env = _op_proc_env(op, run)
    if extra_env:
        env.update(extra_env)
    run.write_attr("env", _remove_private_env(env, op))
    log.debug("starting run %s in %s", run.id, run.dir)
    log.debug("operation command: %s", op.cmd_args)
    log.debug("operation env: %s", env)
    stdout, stderr = _proc_streams(quiet)
    try:
        proc = subprocess.Popen(
            op.cmd_args,
            env=env,
            cwd=run.dir,
            stdout=stdout,
            stderr=stderr,
        )
    except OSError as e:
        raise ProcessError(e)
    else:
        op_util.write_proc_lock(proc.pid, run)
        return proc
Ejemplo n.º 2
0
def _write_proc_lock(run):
    op_util.write_proc_lock(os.getpid(), run)