示例#1
0
def _validate_args(args):
    if args.working and args.working_dir:
        cli.error("--working and --working-dir cannot both be specified")
示例#2
0
def _handle_remote_process_error(e):
    cli.error(exit_status=e.exit_status)
示例#3
0
def _no_matching_run_error(spec, ctx):
    help_msg = (" or '%s' for more information" %
                click_util.cmd_help(ctx) if ctx else "")
    cli.error("could not find a run matching '%s'\n"
              "Try 'guild runs list' for a list%s." % (spec, help_msg))
示例#4
0
def _check_non_pid_args(args):
    if (args.run or args.ops or args.labels or args.unlabeled):
        cli.error("--pid may not be used with other options")
示例#5
0
def _run_for_pid(pid):
    for run_id, run_dir in var.iter_run_dirs():
        run = runlib.Run(run_id, run_dir)
        if run.pid and (run.pid == pid or _parent_pid(run.pid) == pid):
            return run
    cli.error("cannot find run for pid %i" % pid)
示例#6
0
def _handle_remote_process_error(e):
    msg = e.output.decode().strip() if e.output else None
    cli.error(msg, exit_status=e.exit_status)
示例#7
0
def _no_selected_runs_error(help_msg=None):
    help_msg = help_msg or "Try 'guild runs list' to list available runs."
    cli.error("no matching runs\n%s" % help_msg)
示例#8
0
def _no_such_operation_error(name, model):
    cli.error("operation '%s' is not defined for model '%s'\n"
              "Try 'guild operations %s' for a list of available operations." %
              (name, model.name, model.name))
示例#9
0
def _parse_assigns(assign_args):
    try:
        return op_util.parse_flags(assign_args)
    except op_util.ArgValueError as e:
        cli.error("invalid argument '%s' - expected NAME=VAL" % e.arg)
示例#10
0
def _handle_process_error(e):
    cli.error("run failed: %s" % e)
示例#11
0
def _multiple_models_error(model_ref, models):
    models_list = "\n".join(
        ["  %s" % name for name in sorted([m.fullname for m in models])])
    cli.error("there are multiple models that match '%s'\n"
              "Try specifying one of the following:\n"
              "%s" % (model_ref, models_list))
示例#12
0
def _handle_dependency_error(e):
    cli.error("run failed because a dependency was not met: %s" % e)
示例#13
0
def _check_restart_running(args):
    restart_run = getattr(args, "_restart_run", None)
    if restart_run and restart_run.status == "running":
        cli.error("{id} is still running\n"
                  "Wait for it to stop or try 'guild stop {id}' "
                  "to stop it.".format(id=restart_run.id))
示例#14
0
def _check_remote_batch_files(op):
    if op.batch_op and op.batch_op.batch_files:
        cli.error("batch files are not supported with remote operations")
示例#15
0
def _virtualenv_missing_error():
    cli.error(
        "cannot find virtualenv\n" "Try installing it with 'pip install virtualenv'."
    )
示例#16
0
def _coerce_flag_val(val, flagdef):
    try:
        return op_util.coerce_flag_value(val, flagdef)
    except (ValueError, TypeError) as e:
        cli.error("cannot apply %r to flag '%s': %s" % (val, flagdef.name, e))
示例#17
0
def _check_cli():
    if not util.which("aws"):
        cli.error("%s requires the AWS Command Line Interface\n"
                  "Refer to https://docs.aws.amazon.com/cli/latest/"
                  "userguide/installing.html for details." % NAME)
示例#18
0
def _invalid_op_spec_error(e, opdef):
    cli.error("operation %s is not valid: %s" % (opdef.fullname, e))
示例#19
0
def list_runs(args):
    if args.archive:
        cli.error("--archive and --remote cannot both be used")
    remote = remote_support.remote_for_args(args)
    with op_handler(remote):
        remote.list_runs(**_list_runs_kw(args))
示例#20
0
def _op_init_error(e, opdef):
    cli.error("cannot start %s: %s" % (opdef.fullname, e))
示例#21
0
def _parse_tensorboard_opt(opt):
    parts = opt.split("=")
    if len(parts) != 2:
        cli.error("invalid TensorBoard option %r - must be OPTION=VALUE" % opt)
    return parts
示例#22
0
def _validate_args(args):
    if args.rerun and args.restart:
        cli.error("--rerun and --restart cannot both be used\n"
                  "Try 'guild run --help' for more information.")
    if args.run_dir and args.restart:
        cli.error("--restart and --run-dir cannot both be used\n"
                  "Try 'guild run --help' for more information")
    if args.run_dir and args.stage:
        cli.error("--stage and --run-dir cannot both be used\n"
                  "Try 'guild run --help' for more information")
    if args.no_gpus and args.gpus is not None:
        cli.error("--gpus and --no-gpus cannot both be used\n"
                  "Try 'guild run --help' for more information.")
    if args.print_trials and args.init_trials:
        cli.error("--print-trials and --init-trials cannot both be used\n"
                  "Try 'guild run --help' for more information.")
    if args.minimize and args.maximize:
        cli.error("--minimize and --maximize cannot both be used\n"
                  "Try 'guild run --help' for more information.")
    if args.optimize and args.optimizer:
        cli.error("--optimize and --optimizer cannot both be used\n"
                  "Try 'guild run --help' for more information.")
示例#23
0
def _handle_run_error(run_dir):
    run_id = os.path.basename(run_dir)
    cli.error("JOB for %s is no longer running" % run_id, exit_status=2)
示例#24
0
def _invalid_flag_value_error(e):
    cli.error("invalid value for %s: %s" % (e.flag.name, e.msg))
示例#25
0
def _handle_run_failed(e, remote):
    run_id = os.path.basename(e.remote_run_dir)
    cli.out("Try 'guild runs info %s -O -r %s' to view its output." %
            (run_id[:8], remote.name),
            err=True)
    cli.error()
示例#26
0
 def _model_name(self):
     val = self.predicting_run.get("cloudml-model-name")
     if not val:
         cli.error("cannot predict with run %s: missing cloudml-model-name "
                   "attribute" % self.predicting_run.short_id)
     return val
示例#27
0
def _handle_not_supported(remote):
    cli.error("%s does not support this operation" % remote.name)
示例#28
0
def _index_template_readme(dir):
    assert os.path.isdir(dir), dir
    path = os.path.join(dir, "README.md")
    if not os.path.exists(path):
        cli.error("index template '%s' is missing README.md" % dir)
    return path
示例#29
0
def _non_unique_run_id_error(matches, spec):
    cli.out("'%s' matches multiple runs:" % spec, err=True)
    for m in matches:
        cli.out("  %s" % _match_short_id(m), err=True)
    cli.error()
示例#30
0
def _check_args(args):
    if args.package_description and args.markdown:
        cli.error("--package-description and --markdown cannot both be used")