Exemplo n.º 1
0
def _format_run_detail(run, index):
    lines = [
        "Id: %s" % run.id,
        "Operation: %s" % run_util.format_op_desc(run),
        "Status: %s" % run.status,
        "Started: %s" % util.format_timestamp(run.get("started")),
        "Stopped: %s" % util.format_timestamp(run.get("stopped")),
        "Label: %s" % (run.get("label") or ""),
    ]
    flags = run.get("flags")
    if flags:
        lines.append("Flags:")
        for name, val in sorted(flags.items()):
            val = val if val is not None else ""
            lines.append("  {}: {}".format(name, val))
    scalars = list(index.run_scalars(run))
    if scalars:
        lines.append("Scalars:")
        for s in scalars:
            prefix = s["prefix"]
            if prefix:
                lines.append("  %s#%s" % (s["prefix"], s["tag"]))
            else:
                lines.append("  %s" % s["tag"])
    return "\n".join(lines)
Exemplo n.º 2
0
def _print_scalars(args):
    runs = runs_impl.runs_for_args(args)
    index = indexlib.RunIndex()
    index.refresh(runs, ["scalar"])
    for run in runs:
        cli.out("[%s] %s" % (run.short_id, run_util.format_op_desc(run)))
        for s in index.run_scalars(run):
            cli.out("  %s" % run_util.run_scalar_key(s))
Exemplo n.º 3
0
 def _row_for_print_run(run, flags, labels, status):
     row = {"opspec": run_util.format_op_desc(run)}
     if flags:
         flag_vals = run.get("flags") or {}
         flags_desc = " ".join(op_util.flag_assigns(flag_vals, quote=True))
         row["flags"] = flags_desc
     if labels:
         row["label"] = run.get("label", "")
     if status:
         row["status"] = run.status
     return row
Exemplo n.º 4
0
def _print_scalars(args):
    runs = runs_impl.runs_for_args(args)
    index = indexlib.RunIndex()
    index.refresh(runs, ["scalar"])
    for run in runs:
        cli.out("[%s] %s" % (run.short_id, run_util.format_op_desc(run)))
        for s in index.run_scalars(run):
            prefix = s["prefix"]
            if prefix:
                cli.out("  %s#%s" % (s["prefix"], s["tag"]))
            else:
                cli.out("  %s" % s["tag"])
Exemplo n.º 5
0
 def _row_for_print_run(run, flags, labels, status):
     row = {"opspec": run_util.format_op_desc(run)}
     if flags:
         flags_desc = " ".join([
             "%s=%s" % (name, run_util.format_flag_val(val))
             for name, val in sorted(run.get("flags").items())
         ])
         row["flags"] = flags_desc
     if labels:
         row["label"] = run.get("label", "")
     if status:
         row["status"] = run.status
     return row
Exemplo n.º 6
0
 def _run_data(self, run):
     opref = run.opref
     started = run.get("started")
     stopped = run.get("stopped")
     status = run.status
     return {
         "id": run.id,
         "run": run.short_id,
         "model": opref.model_name,
         "operation": run_util.format_op_desc(run),
         "op": opref.op_name,
         "started": util.format_timestamp(started),
         "stopped": util.format_timestamp(stopped),
         "status": status,
         "time": self._duration(status, started, stopped),
     }
Exemplo n.º 7
0
 def _op_source_info(self, path):
     if not os.path.islink(path):
         return None, None
     path = os.path.realpath(path)
     runs_dir = var.runs_dir()
     if not path.startswith(runs_dir):
         return None, None
     subdir = path[len(runs_dir)+1:]
     parts = subdir.split(os.path.sep, 1)
     try:
         run = self._run_for_id(parts[0])
     except LookupError:
         return "%s (deleted)" % parts[0][:8], None
     else:
         operation = run_util.format_op_desc(run, nowarn=True)
         return operation, run.short_id
Exemplo n.º 8
0
 def f(run):
     op_desc = run_util.format_op_desc(run, nowarn=True)
     return any((ref in op_desc for ref in op_refs))
Exemplo n.º 9
0
 def _format_dep(run, paths):
     return {
         "run": run.short_id,
         "operation": run_util.format_op_desc(run, nowarn=True),
         "paths": paths
     }