예제 #1
0
def filtered_runs(args, ctx=None):
    if getattr(args, "remote", None):
        return remote_impl_support.filtered_runs(args)
    else:
        return var.runs(
            _runs_root_for_args(args),
            sort=["-timestamp"],
            filter=_runs_filter(args, ctx),
        )
예제 #2
0
def _batch_trial_runs(batch_run):
    """Returns trial runs associated with a batch run."""
    runs = var.runs(
        batch_run.dir,
        filter=_completed_filter,
        sort=["timestamp"],
        force_root=True,
    )
    _apply_batch_runs_realpath(runs)
    return runs
예제 #3
0
def _ac_run(incomplete, ctx, **_kw):
    from guild import config
    from guild import var

    with config.SetGuildHome(ctx.parent.params.get("guild_home")):
        runs = var.runs(
            sort=["-timestamp"],
            filter=lambda r: r.id.startswith(incomplete),
        )
    return [run.id for run in runs]
예제 #4
0
    def seq_trial_runs(self, status=None):
        if isinstance(status, six.string_types):
            status = [status]
        batch_run_id = self.batch_run.id

        def filter(run):
            return (run.get("batch") == batch_run_id
                    and (status is None or run.status in status))

        return var.runs(filter=filter)
예제 #5
0
 def _latest_op_run(self, opref):
     resolved_opref = self._fully_resolve_opref(opref)
     completed_op_runs = var.run_filter("all", [
         var.run_filter("any", [
             var.run_filter("attr", "status", "completed"),
             var.run_filter("attr", "status", "running"),
         ]), resolved_opref.is_op_run
     ])
     runs = var.runs(sort=["-started"], filter=completed_op_runs)
     if runs:
         return runs[0]
     raise ResolutionError("no suitable run for %s" %
                           self._opref_desc(resolved_opref))
예제 #6
0
 def sync(self):
     runs = {run.id: run for run in var.runs()}
     reader = self.ix.reader()
     writer = self.ix.writer()
     for docnum, fields in reader.iter_docs():
         run_id = fields["id"]
         run = runs.pop(run_id, None)
         if run:
             self._reindex_changed_run(run, fields, writer)
         else:
             self._delete_run(docnum, run_id, writer)
     for run in runs.values():
         self._index_run(run, writer)
     log.debug("committing changes")
     # We'd like to use commit(optimize=True here but there's a bug
     # that causes our 'priv_xxx' fields to be deleted. See
     # https://bitbucket.org/mchaput/whoosh/issues/472 for details.
     writer.commit()
예제 #7
0
def filtered_runs(args, force_deleted=False, ctx=None):
    return var.runs(
        _runs_root_for_args(args, force_deleted),
        sort=["-timestamp"],
        filter=_runs_filter(args, ctx),
    )
예제 #8
0
파일: resolver.py 프로젝트: yuanbw/guildai
def matching_runs(oprefs, run_id_prefix=None):
    oprefs = [_resolve_opref(opref) for opref in oprefs]
    runs_filter = _runs_filter(oprefs, run_id_prefix)
    return var.runs(sort=["-started"], filter=runs_filter)
예제 #9
0
def _running_runs():
    running = var.runs(filter=var.run_filter("attr", "status", "running"))
    return [run for run in running if run.id != RUN_ID]
예제 #10
0
def _staged_runs():
    return var.runs(sort=["timestamp"],
                    filter=var.run_filter("attr", "status", "staged"))
예제 #11
0
def find_matching_runs(opref, flag_vals, include_pending=False):
    return [
        run for run in var.runs()
        if is_matching_run(run, opref, flag_vals, include_pending)
    ]
예제 #12
0
def _proto_op_runs(batch_run):
    """Returns runs whose op matches that of a batch proto."""
    return var.runs(
        filter=_completed_op_filter(batch_run.batch_proto),
        sort=["timestamp"],
    )
예제 #13
0
def matching_runs(oprefs, run_id_prefix=None, status=None):
    status = status or DEFAULT_MATCHING_RUN_STATUS
    oprefs = [_resolve_opref(opref) for opref in oprefs]
    runs_filter = _runs_filter(oprefs, run_id_prefix, status)
    return var.runs(sort=["-started"], filter=runs_filter)
예제 #14
0
def _blocking_runs(state):
    if not state.wait_for_running:
        return []
    running = var.runs(filter=var.run_filter("attr", "status", "running"))
    return [run for run in running if not _is_queue_or_self(run, state)]
예제 #15
0
파일: ipy.py 프로젝트: wingkitlee0/guildai
def runs():
    runs = var.runs(sort=["-timestamp"])
    data, cols = _format_runs(runs)
    return RunsDataFrame(data=data, columns=cols)
예제 #16
0
def _running(state):
    running = var.runs(filter=var.run_filter("attr", "status", "running"))
    return [run for run in running if run.id != state.run_id]
예제 #17
0
def runs_for_args(args, force_deleted=False):
    return var.runs(_runs_root_for_args(args, force_deleted),
                    sort=["-started"],
                    filter=_runs_filter(args),
                    run_init=_init_run)
예제 #18
0
def _running(state):
    running = var.runs(filter=var.run_filter("attr", "status", "running"))
    return [run for run in running if not _is_queue_or_self(run, state)]
예제 #19
0
def trial_runs(batch_run):
    runs = var.runs(batch_run.dir, sort=["timestamp"], force_root=True)
    # Update run dirs to real location rather than links under batch run.
    for run in runs:
        run.path = util.realpath(run.path)
    return runs
예제 #20
0
def _proto_sourcecode_runs(batch_run):
    """Returns runs whose sourcecode digest matches that of a batch proto."""
    return var.runs(
        filter=_completed_sourcecode_filter(batch_run.batch_proto),
        sort=["timestamp"],
    )