예제 #1
0
파일: view_impl.py 프로젝트: yuanbw/guildai
 def one_run(run_id_prefix):
     try:
         id, path = next(var.find_runs(run_id_prefix))
     except StopIteration:
         return None
     else:
         return guild.run.Run(id, path)
예제 #2
0
def main(args):
    run = cmd_impl_support.one_run(
        [guild.run.Run(id, path) for id, path in var.find_runs(args.run)],
        args.run)
    if args.clear:
        run.del_attr("label")
    else:
        run.write_attr("label", args.label)
예제 #3
0
def _one_run(run_prefix):
    matches = var.find_runs(run_prefix)
    if not matches:
        cli.error("cannot find a run for '%s'\n"
                  "Try 'guild runs list' for a list of available runs." %
                  run_prefix)
    elif len(matches) > 1:
        cli.error("more than one run matches '%s'\n"
                  "Try again with a unique run ID." % run_prefix)
    run_id, path = matches[0]
    return guild.run.Run(run_id, path)
예제 #4
0
 def get_detail(data, y, _x):
     run_short_id = data[y][0]
     title = "Run {}".format(run_short_id)
     try:
         run_id, _ = next(var.find_runs(run_short_id))
     except StopIteration:
         return "This run no longer exists", title
     else:
         hits = index.runs([run_id])
         if not hits:
             return "Detail not available", title
         else:
             return _format_run_detail(hits[0]), title
예제 #5
0
 def f(data, y, _x):
     run_short_id = data[y][0]
     if run_short_id == NO_RUNS_CAPTION:
         return ("\nPress 'r' in the main screen to refresh the list.",
                 "There are no matching runs currently")
     title = "Run {}".format(run_short_id)
     try:
         run_id, path = next(var.find_runs(run_short_id))
     except StopIteration:
         return "This run no longer exists.", title
     else:
         run = runlib.Run(run_id, path)
         index.refresh([run], ["scalar"])
         detail = _format_run_detail(run, index)
         return detail, title
예제 #6
0
def _mark_impl(view, flag):
    if not view.data:
        return
    run_short_id = view.data[view.y][0]
    try:
        run_id, path = next(var.find_runs(run_short_id))
    except StopIteration:
        view.text_box(
            "This run no longer exists.\n"
            "\n"
            "Press 'q' to exist this screen and then press 'r' to "
            "refresh the list.", run_short_id)
    else:
        run = runlib.Run(run_id, path)
        _mark_run(run, flag)
        _try_mark_operation(view, flag)
예제 #7
0
def one_run(run_id_prefix):
    runs = [runlib.Run(id, path) for id, path in var.find_runs(run_id_prefix)]
    return cmd_impl_support.one_run(runs, run_id_prefix)