Example #1
0
def _runs_for_parent_links(parent_path, names, runs_dir):
    real_paths = [util.realpath(os.path.join(parent_path, name)) for name in names]
    return [
        runlib.for_dir(path)
        for path in real_paths
        if _is_parent_run_path(path, runs_dir)
    ]
Example #2
0
 def run_capture(self, *args, **kw):
     """Runs an operation returning a tuple of run and output."""
     run_dir = self._run_dir_apply(kw)
     out = self._run(*args, **kw)
     return runlib.for_dir(run_dir), out
Example #3
0
def _apply_batch_proto(run, data):
    proto_dir = run.guild_path("proto")
    if os.path.exists(proto_dir):
        proto = runlib.for_dir(proto_dir)
        data["batch_proto"] = _listed_run_json_data(proto)
Example #4
0
def _run_for_job_pidfile(pid_arg):
    m = re.search(r"(.+)/\.guild/JOB$", pid_arg)
    if not m:
        return None
    run_dir = m.group(1)
    return runlib.for_dir(run_dir)
Example #5
0
def _init_run(args):
    if args.run_dir:
        return runlib.for_dir(args.run_dir)
    return op_util.current_run()