mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
queue start: simply jobs validation
This commit is contained in:
committed by
Peter Rowlands (변기호)
parent
3130a9a75f
commit
ed593493df
+10
-14
@@ -17,24 +17,16 @@ class CmdQueueStart(CmdBase):
|
||||
)
|
||||
|
||||
suffix = "s" if started > 1 else ""
|
||||
ui.write(f"Start {started} new worker{suffix} to process the queue.")
|
||||
ui.write(
|
||||
f"Started '{started}' new experiments task queue worker{suffix}."
|
||||
)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def job_type(job):
|
||||
try:
|
||||
job = int(job)
|
||||
if job > 0:
|
||||
return job
|
||||
except ValueError:
|
||||
pass
|
||||
raise argparse.ArgumentTypeError("Worker number must be a natural number.")
|
||||
|
||||
|
||||
def add_parser(queue_subparsers, parent_parser):
|
||||
|
||||
QUEUE_START_HELP = "Start experiments queue workers."
|
||||
QUEUE_START_HELP = "Start the experiments task queue worker."
|
||||
queue_start_parser = queue_subparsers.add_parser(
|
||||
"start",
|
||||
parents=[parent_parser],
|
||||
@@ -45,8 +37,12 @@ def add_parser(queue_subparsers, parent_parser):
|
||||
queue_start_parser.add_argument(
|
||||
"-j",
|
||||
"--jobs",
|
||||
type=job_type,
|
||||
type=int,
|
||||
default=1,
|
||||
help="Number of queue workers to start.",
|
||||
help=(
|
||||
"Maximum number of concurrent queue workers to start. "
|
||||
"Defaults to 1."
|
||||
),
|
||||
metavar="<number>",
|
||||
)
|
||||
queue_start_parser.set_defaults(func=CmdQueueStart)
|
||||
|
||||
Reference in New Issue
Block a user