Skip to content

Commit

Permalink
cli: update task_globs terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Mar 15, 2019
1 parent 5b6c938 commit fd4a416
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 46 deletions.
8 changes: 4 additions & 4 deletions bin/cylc-hold
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

"""cylc [control] hold [OPTIONS] ARGS
Hold one or more waiting tasks (cylc hold REG TASKID ...), or
Hold one or more waiting tasks (cylc hold REG TASK_GLOB ...), or
a whole suite (cylc hold REG).
Held tasks do not submit even if they are ready to run.
Expand All @@ -44,7 +44,7 @@ def main():
__doc__, comms=True, multitask=True,
argdoc=[
("REG", "Suite name"),
('[TASKID ...]', 'Task identifiers')])
('[TASK_GLOB ...]', 'Task matching patterns')])

parser.add_option(
"--after",
Expand All @@ -66,10 +66,10 @@ def main():
suite, options.owner, options.host, options.port)

if args:
items = parser.parse_multitask_compat(options, args)
task_globs = parser.parse_multitask_compat(options, args)
pclient(
'hold_tasks',
{'task_globs': items},
{'task_globs': task_globs},
timeout=options.comms_timeout
)
elif options.hold_point_string:
Expand Down
4 changes: 2 additions & 2 deletions bin/cylc-kill
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Kill jobs of active tasks and update their statuses accordingly.
To kill one or more tasks, "cylc kill REG TASKID ..."; to kill all active
To kill one or more tasks, "cylc kill REG TASK_GLOB ..."; to kill all active
tasks: "cylc kill REG".
"""

Expand All @@ -43,7 +43,7 @@ def main():
__doc__, comms=True, multitask=True,
argdoc=[
('REG', 'Suite name'),
('[TASKID ...]', 'Task identifiers')])
('[TASK_GLOB ...]', 'Task matching patterns')])

options, args = parser.parse_args()

Expand Down
12 changes: 6 additions & 6 deletions bin/cylc-poll
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
Poll (query) task jobs to verify and update their statuses.
Use "cylc poll REG" to poll all active tasks, or "cylc poll REG TASKID" to poll
individual tasks or families, or groups of them.
Use "cylc poll REG" to poll all active tasks, or "cylc poll REG TASK_GLOB"
to poll individual tasks or families, or groups of them.
"""

import sys
Expand All @@ -42,7 +42,7 @@ def main():
__doc__, comms=True, multitask=True,
argdoc=[
('REG', 'Suite name'),
('[TASKID ...]', 'Task identifiers')])
('[TASK_GLOB ...]', 'Task matching patterns')])

parser.add_option(
"-s", "--succeeded", help="Allow polling of succeeded tasks.",
Expand All @@ -58,14 +58,14 @@ def main():
pclient = SuiteRuntimeClient(
suite, options.owner, options.host, options.port,
options.comms_timeout)
items = parser.parse_multitask_compat(options, args)
task_globs = parser.parse_multitask_compat(options, args)
# Back compat: back_out introduced >7.5.0
# So don't call with "poll_succ" if not necessary to avoid breakage.
if options.poll_succ:
pclient('poll_tasks',
{'task_globs': items, 'poll_succ': options.poll_succ})
{'task_globs': task_globs, 'poll_succ': options.poll_succ})
else:
pclient('poll_tasks', {'task_globs': items})
pclient('poll_tasks', {'task_globs': task_globs})


if __name__ == "__main__":
Expand Down
8 changes: 4 additions & 4 deletions bin/cylc-release
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

"""cylc [control] release|unhold [OPTIONS] ARGS
Release one or more held tasks (cylc release REG TASKID)
Release one or more held tasks (cylc release REG TASK_GLOB)
or the whole suite (cylc release REG). Held tasks do not
submit even if they are ready to run.
Expand All @@ -43,7 +43,7 @@ def main():
__doc__, comms=True, multitask=True,
argdoc=[
("REG", 'Suite name'),
('[TASKID ...]', 'Task identifiers')])
('[TASK_GLOB ...]', 'Task matching patterns')])

options, args = parser.parse_args()
suite = args.pop(0)
Expand All @@ -56,8 +56,8 @@ def main():
suite, options.owner, options.host, options.port,
options.comms_timeout)
if args:
items = parser.parse_multitask_compat(options, args)
pclient('release_tasks', {'task_globs': items})
task_globs = parser.parse_multitask_compat(options, args)
pclient('release_tasks', {'task_globs': task_globs})
else:
pclient('release_suite')

Expand Down
8 changes: 4 additions & 4 deletions bin/cylc-remove
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

"""cylc [control] remove [OPTIONS] ARGS
Remove one or more tasks (cylc remove REG TASKID), or all tasks with a
Remove one or more tasks (cylc remove REG TASK_GLOB), or all tasks with a
given cycle point (cylc remove REG *.POINT) from a running suite.
Tasks will spawn successors first if they have not done so already.
Expand All @@ -42,7 +42,7 @@ def main():
__doc__, comms=True, multitask=True,
argdoc=[
("REG", "Suite name"),
('TASKID [...]', 'Task identifiers')])
('TASK_GLOB [...]', 'Task matching patterns')])

parser.add_option(
"--no-spawn",
Expand All @@ -56,10 +56,10 @@ def main():
pclient = SuiteRuntimeClient(
suite, options.owner, options.host, options.port,
options.comms_timeout)
items = parser.parse_multitask_compat(options, args)
task_globs = parser.parse_multitask_compat(options, args)
pclient(
'remove_tasks',
{'task_globs': items, 'spawn': (not options.no_spawn)}
{'task_globs': task_globs, 'spawn': (not options.no_spawn)}
)


Expand Down
6 changes: 3 additions & 3 deletions bin/cylc-reset
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def main():
__doc__, comms=True, multitask=True,
argdoc=[
('REG', 'Suite name'),
('[TASKID ...]', 'Task identifiers')])
('[TASK_GLOB ...]', 'Task matching patterns')])

parser.add_option(
"-s", "--state", metavar="STATE",
Expand Down Expand Up @@ -96,10 +96,10 @@ def main():
pclient = SuiteRuntimeClient(
suite, options.owner, options.host, options.port,
options.comms_timeout)
items = parser.parse_multitask_compat(options, args)
task_globs = parser.parse_multitask_compat(options, args)
pclient(
'reset_task_states',
{'task_globs': items, 'state': options.state,
{'task_globs': task_globs, 'state': options.state,
'outputs': options.outputs}
)

Expand Down
2 changes: 1 addition & 1 deletion bin/cylc-show
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def main():
__doc__, comms=True, noforce=True, multitask=True,
argdoc=[
('REG', 'Suite name'),
('[TASKID ...]', 'Task names or identifiers')])
('[TASK_GLOB ...]', 'Task matching patterns')])

parser.add_option('--list-prereqs', action="store_true", default=False,
help="Print a task's pre-requisites as a list.")
Expand Down
2 changes: 1 addition & 1 deletion bin/cylc-spawn
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def main():
__doc__, comms=True, multitask=True,
argdoc=[
('REG', 'Suite name'),
('[TASKID ...]', 'Task identifiers')])
('[TASK_GLOB ...]', 'Task matching patterns')])

options, args = parser.parse_args()

Expand Down
17 changes: 7 additions & 10 deletions bin/cylc-trigger
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def main():
__doc__, comms=True, multitask=True,
argdoc=[
('REG', 'Suite name'),
('[TASKID ...]', 'Task identifiers')])
('[TASK_GLOB ...]', 'Task matching patterns')])

parser.add_option(
"-e", "--edit",
Expand All @@ -86,8 +86,8 @@ def main():

aborted = False
if options.edit_run:
items = parser.parse_multitask_compat(options, args)
task_id = items[0]
task_globs = parser.parse_multitask_compat(options, args)
task_id = task_glob[0]
# Check that TASK is a unique task.
success, msg = pclient(
'ping_task',
Expand Down Expand Up @@ -191,13 +191,10 @@ def main():
aborted = True

# Trigger the task proxy(s).
items = parser.parse_multitask_compat(options, args)
# Back compat: back_out introduced >7.5.0
# So don't call with "back_out" if not necessary to avoid breakage.
if aborted:
pclient('trigger_tasks', {'task_globs': items, 'back_out': aborted})
else:
pclient('trigger_tasks', {'task_globs': items})
pclient('trigger_tasks', {
'task_globs': parser.parse_multitask_compat(options, args),
'back_out': aborted
})


if __name__ == "__main__":
Expand Down
14 changes: 3 additions & 11 deletions lib/cylc/option_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class CylcOptionParser(OptionParser):
"""Common options for all cylc CLI commands."""

MULTITASK_USAGE = """
TASKID is a pattern to match task proxies or task families, or groups of them:
TASK_GLOB is a pattern to match task proxies or task families,
or groups of them:
* [CYCLE-POINT-GLOB/]TASK-NAME-GLOB[:TASK-STATE]
* [CYCLE-POINT-GLOB/]FAMILY-NAME-GLOB[:TASK-STATE]
* TASK-NAME-GLOB[.CYCLE-POINT-GLOB][:TASK-STATE]
Expand All @@ -49,7 +50,7 @@ class CylcOptionParser(OptionParser):
The old 'MATCH POINT' syntax will be automatically detected and supported. To
avoid this, use the '--no-multitask-compat' option, or use the new syntax
(with a '/' or a '.') when specifying 2 TASKID arguments."""
(with a '/' or a '.') when specifying 2 TASK_GLOB arguments."""

def __init__(self, usage, argdoc=None, comms=False, noforce=False,
jset=False, multitask=False, prep=False, auto_add=True,
Expand Down Expand Up @@ -212,15 +213,6 @@ def add_std_options(self):
action="store", default=None, dest="templatevars_file")

if self.multitask:
self.add_std_option(
"-m", "--family",
help=(
"(Obsolete) This option is now ignored "
"and is retained for backward compatibility only. "
"TASKID in the argument list can be used to match "
"task and family names regardless of this option."),
action="store_true", default=False, dest="is_family")

self.add_std_option(
"--no-multitask-compat",
help="Disallow backward compatible multitask interface.",
Expand Down

0 comments on commit fd4a416

Please sign in to comment.