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), )
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
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]
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)
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))
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()
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), )
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)
def _running_runs(): running = var.runs(filter=var.run_filter("attr", "status", "running")) return [run for run in running if run.id != RUN_ID]
def _staged_runs(): return var.runs(sort=["timestamp"], filter=var.run_filter("attr", "status", "staged"))
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) ]
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"], )
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)
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)]
def runs(): runs = var.runs(sort=["-timestamp"]) data, cols = _format_runs(runs) return RunsDataFrame(data=data, columns=cols)
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]
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)
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)]
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
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"], )