diff --git a/CHANGES.md b/CHANGES.md index 5688a8786fd..f70a3a4ae45 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -100,6 +100,10 @@ workflow directory are recorded by `log/version`. [#4404](https://github.com/cylc/cylc-flow/pull/4404) - The Cylc Graph section now accepts ``&`` and ``|`` as valid line breaks in the same way as ``=>``. +[#4455](https://github.com/cylc/cylc-flow/pull/4455) - `CYLC_WORKFLOW_NAME` +renamed to `CYLC_WORKFLOW_ID`. `CYLC_WORKFLOW_NAME` re-added as +`CYLC_WORKFLOW_ID` shorn of any trailing `runX`. + ### Fixes diff --git a/cylc/flow/config.py b/cylc/flow/config.py index 1c749ebb0e4..0d58d96c573 100644 --- a/cylc/flow/config.py +++ b/cylc/flow/config.py @@ -75,6 +75,7 @@ get_workflow_run_log_dir, get_workflow_run_share_dir, get_workflow_run_work_dir, + get_workflow_name_from_id ) from cylc.flow.platforms import FORBIDDEN_WITH_PLATFORM from cylc.flow.print_tree import print_tree @@ -182,7 +183,8 @@ def __init__( if self.mem_log is None: self.mem_log = lambda x: None self.mem_log("config.py:config.py: start init config") - self.workflow = workflow # workflow name + self.workflow = workflow # workflow id + self.workflow_name = get_workflow_name_from_id(self.workflow) self.fpath = str(fpath) # workflow definition self.fdir = os.path.dirname(fpath) self.run_dir = run_dir or get_workflow_run_dir(self.workflow) @@ -1353,7 +1355,8 @@ def process_workflow_env(self): """Workflow context is exported to the local environment.""" for key, value in { **verbosity_to_env(cylc.flow.flags.verbosity), - 'CYLC_WORKFLOW_NAME': self.workflow, + 'CYLC_WORKFLOW_ID': self.workflow, + 'CYLC_WORKFLOW_NAME': self.workflow_name, 'CYLC_WORKFLOW_RUN_DIR': self.run_dir, 'CYLC_WORKFLOW_LOG_DIR': self.log_dir, 'CYLC_WORKFLOW_WORK_DIR': self.work_dir, diff --git a/cylc/flow/option_parsers.py b/cylc/flow/option_parsers.py index 4ad2107e08a..15231f79924 100644 --- a/cylc/flow/option_parsers.py +++ b/cylc/flow/option_parsers.py @@ -177,9 +177,9 @@ def __init__( self.auto_add = auto_add if argdoc is None: if prep: - argdoc = [('WORKFLOW', 'Workflow name or path')] + argdoc = [('WORKFLOW | PATH', 'Workflow name or path')] else: - argdoc = [('REG', 'Workflow name')] + argdoc = [('WORKFLOW', 'Workflow name')] if '--color=never' not in '='.join(sys.argv[2:]): # Before option parsing, for `--help`, make comments grey in usage. diff --git a/cylc/flow/pathutil.py b/cylc/flow/pathutil.py index 1cca62ca66e..9dbfc17460e 100644 --- a/cylc/flow/pathutil.py +++ b/cylc/flow/pathutil.py @@ -409,3 +409,15 @@ def is_relative_to(path1: Union[Path, str], path2: Union[Path, str]) -> bool: except ValueError: return False return True + + +def get_workflow_name_from_id(workflow_id: str) -> str: + """Workflow name is the ID shorn of the runN directory name. + + Examples: + >>> get_workflow_name_from_id('my_workflow/run42') + 'my_workflow' + >>> get_workflow_name_from_id('my_other_workflow') + 'my_other_workflow' + """ + return re.sub(rf'{re.escape(os.sep)}run\d+$', '', workflow_id) diff --git a/cylc/flow/scheduler.py b/cylc/flow/scheduler.py index 0f6e39f649e..58d85b0132e 100644 --- a/cylc/flow/scheduler.py +++ b/cylc/flow/scheduler.py @@ -76,7 +76,8 @@ get_workflow_run_share_dir, get_workflow_run_work_dir, get_workflow_test_log_name, - make_workflow_run_tree + make_workflow_run_tree, + get_workflow_name_from_id ) from cylc.flow.platforms import ( get_install_target_from_platform, @@ -245,6 +246,7 @@ class Scheduler: def __init__(self, reg: str, options: Values) -> None: # flow information self.workflow = reg + self.workflow_name = get_workflow_name_from_id(self.workflow) self.owner = get_user() self.host = get_host() self.id = f'{self.owner}{ID_DELIM}{self.workflow}' @@ -1104,7 +1106,8 @@ def load_flow_file(self, is_reload=False): self.task_job_mgr.job_file_writer.set_workflow_env({ **verbosity_to_env(cylc.flow.flags.verbosity), 'CYLC_UTC': str(get_utc_mode()), - 'CYLC_WORKFLOW_NAME': self.workflow, + 'CYLC_WORKFLOW_ID': self.workflow, + 'CYLC_WORKFLOW_NAME': self.workflow_name, 'CYLC_CYCLING_MODE': str( self.config.cfg['scheduling']['cycling mode'] ), diff --git a/cylc/flow/scheduler_cli.py b/cylc/flow/scheduler_cli.py index 359f88c2053..fc1fedadee3 100644 --- a/cylc/flow/scheduler_cli.py +++ b/cylc/flow/scheduler_cli.py @@ -71,16 +71,18 @@ as satisfied. Examples: - # Start (at the initial cycle point), or restart, or resume workflow REG - $ cylc play REG + # Start (at the initial cycle point), restart, or resume workflow WORKFLOW + $ cylc play WORKFLOW # Start a new run from a cycle point after the initial cycle point - $ cylc play --start-cycle-point=3 REG # (integer cycling) - $ cylc play --start-cycle-point=20250101T0000Z REG # (datetime cycling) + # (integer cycling) + $ cylc play --start-cycle-point=3 WORKFLOW + # (datetime cycling): + $ cylc play --start-cycle-point=20250101T0000Z WORKFLOW # Start a new run from specified tasks in the graph - $ cylc play --start-task=foo.3 REG - $ cylc play -t foo.3 -t bar.3 REG + $ cylc play --start-task=foo.3 WORKFLOW + $ cylc play -t foo.3 -t bar.3 WORKFLOW # Start, restart or resume the second installed run of the workflow # "dogs/fido" @@ -91,7 +93,7 @@ """ -FLOW_NAME_ARG_DOC = ("REG", "Workflow name") +FLOW_NAME_ARG_DOC = ("WORKFLOW", "Workflow name or ID") RESUME_MUTATION = ''' mutation ( diff --git a/cylc/flow/scripts/broadcast.py b/cylc/flow/scripts/broadcast.py index be187e08284..d589d43c0b5 100755 --- a/cylc/flow/scripts/broadcast.py +++ b/cylc/flow/scripts/broadcast.py @@ -48,20 +48,20 @@ Examples: # To broadcast a variable to all tasks (quote items with internal spaces): - $ cylc broadcast -s "[environment]VERSE = the quick brown fox" REG + $ cylc broadcast -s "[environment]VERSE = the quick brown fox" WORKFLOW # To do the same with a file: $ cat >'broadcast.cylc' <<'__FLOW__' $ [environment] $ VERSE = the quick brown fox $ __FLOW__ - $ cylc broadcast -F 'broadcast.cylc' REG + $ cylc broadcast -F 'broadcast.cylc' WORKFLOW # To cancel the same broadcast: - $ cylc broadcast --cancel "[environment]VERSE" REG + $ cylc broadcast --cancel "[environment]VERSE" WORKFLOW # If -F FILE was used, the same file can be used to cancel the broadcast: - $ cylc broadcast -G 'broadcast.cylc' REG + $ cylc broadcast -G 'broadcast.cylc' WORKFLOW Use -d/--display to see active broadcasts. Multiple --cancel options or multiple --set and --set-file options can be used on the same command line. @@ -224,7 +224,7 @@ def get_option_parser(): """CLI for "cylc broadcast".""" parser = COP( __doc__, comms=True, - argdoc=[('REG', "Workflow name")] + argdoc=[('WORKFLOW', 'Workflow name or ID')] ) parser.add_option( diff --git a/cylc/flow/scripts/cat_log.py b/cylc/flow/scripts/cat_log.py index f5b136deb20..ade52ce5cee 100755 --- a/cylc/flow/scripts/cat_log.py +++ b/cylc/flow/scripts/cat_log.py @@ -225,7 +225,7 @@ def get_option_parser(): parser = COP( __doc__, argdoc=[ - ("REG", "Workflow name"), + ("WORKFLOW", "Workflow name or ID"), ("[TASK-ID]", """Task ID""") ] ) diff --git a/cylc/flow/scripts/clean.py b/cylc/flow/scripts/clean.py index 4a910f362a5..5b40177e420 100644 --- a/cylc/flow/scripts/clean.py +++ b/cylc/flow/scripts/clean.py @@ -71,7 +71,7 @@ def get_option_parser(): parser = COP( __doc__, - argdoc=[('REG', "Workflow name")], + argdoc=[('WORKFLOW', 'Workflow name or ID')], segregated_log=True ) diff --git a/cylc/flow/scripts/client.py b/cylc/flow/scripts/client.py index 244c18f3ace..4a4335b14bc 100755 --- a/cylc/flow/scripts/client.py +++ b/cylc/flow/scripts/client.py @@ -44,7 +44,7 @@ def get_option_parser(): parser = COP(__doc__, comms=True, argdoc=[ - ('REG', 'Workflow name'), + ('WORKFLOW', 'Workflow name or ID'), ('METHOD', 'Network API function name')]) parser.add_option( diff --git a/cylc/flow/scripts/config.py b/cylc/flow/scripts/config.py index 9380ec49d58..1a352f56723 100755 --- a/cylc/flow/scripts/config.py +++ b/cylc/flow/scripts/config.py @@ -20,8 +20,9 @@ Parse and print Cylc configuration files. -Print parsed configuration, after runtime inheritance. If REG is specified, -print the workflow configuration, otherwise print the global configuration. +Print parsed configuration, after runtime inheritance. If WORKFLOW is +specified, print the workflow configuration, otherwise print the global +configuration. Note: This is different to `cylc view` which doesn't parse the configuration, @@ -66,7 +67,7 @@ def get_option_parser(): parser = COP( __doc__, - argdoc=[("[REG]", "Workflow name or path")], + argdoc=[("[WORKFLOW]", "Workflow name, ID, or path")], jset=True, icp=True ) diff --git a/cylc/flow/scripts/ext_trigger.py b/cylc/flow/scripts/ext_trigger.py index 12fa42b9705..a10595d34a0 100755 --- a/cylc/flow/scripts/ext_trigger.py +++ b/cylc/flow/scripts/ext_trigger.py @@ -75,7 +75,7 @@ def get_option_parser(): parser = COP( __doc__, comms=True, - argdoc=[("REG", "Workflow name"), + argdoc=[("WORKFLOW", "Workflow name or ID"), ("MSG", "External trigger message"), ("ID", "Unique trigger ID")]) diff --git a/cylc/flow/scripts/get_workflow_contact.py b/cylc/flow/scripts/get_workflow_contact.py index e206e170b88..be1f41f063e 100755 --- a/cylc/flow/scripts/get_workflow_contact.py +++ b/cylc/flow/scripts/get_workflow_contact.py @@ -32,7 +32,7 @@ def get_option_parser(): - return COP(__doc__, argdoc=[('REG', 'Workflow name')]) + return COP(__doc__, argdoc=[('WORKFLOW', 'Workflow name or ID')]) @cli_function(get_option_parser) diff --git a/cylc/flow/scripts/hold.py b/cylc/flow/scripts/hold.py index d616e92337b..192ab3992c2 100755 --- a/cylc/flow/scripts/hold.py +++ b/cylc/flow/scripts/hold.py @@ -97,7 +97,7 @@ def get_option_parser() -> COP: parser = COP( __doc__, comms=True, multitask=True, argdoc=[ - ('REG', "Workflow name"), + ('WORKFLOW', 'Workflow name or ID'), # TODO: switch back to TASK_ID? ('[TASK_GLOB ...]', "Task matching patterns")] ) diff --git a/cylc/flow/scripts/install.py b/cylc/flow/scripts/install.py index 41248857c34..ea8b65e3c5e 100755 --- a/cylc/flow/scripts/install.py +++ b/cylc/flow/scripts/install.py @@ -22,18 +22,18 @@ The workflow can then be started, stopped, and targeted by name. -Normal installation creates a directory "~/cylc-run/REG/", with a run -directory "~/cylc-run/REG/run1". A "_cylc-install/source" symlink to the source -directory will be created in the REG directory. +Normal installation creates a directory "~/cylc-run/WORKFLOW_NAME/", with a run +directory "~/cylc-run/WORKFLOW_NAME/run1". A "_cylc-install/source" symlink to +the source directory will be created in the WORKFLOW_NAME directory. Any files or directories (excluding .git, .svn) from the source directory are copied to the new run directory. A ".service" directory will also be created and used for server authentication files at run time. -If the argument REG is used, Cylc will search for the workflow in the list of -directories given by "global.cylc[install]source dirs", and install the first -match. Otherwise, the workflow in the current working directory, or the one -specified by the "--directory" option, will be installed. +If the argument WORKFLOW_NAME is used, Cylc will search for the workflow in the +list of directories given by "global.cylc[install]source dirs", and install the +first match. Otherwise, the workflow in the current working directory, or the +one specified by the "--directory" option, will be installed. Workflow names can be hierarchical, corresponding to the path under ~/cylc-run. @@ -86,7 +86,7 @@ def get_option_parser(): parser = COP( __doc__, comms=True, prep=True, - argdoc=[("[REG]", "Workflow name")] + argdoc=[('[WORKFLOW_NAME]', 'Workflow name')] ) parser.add_option( @@ -153,7 +153,8 @@ def install( source = opts.source else: if opts.source: - parser.error("REG and --directory are mutually exclusive.") + parser.error( + "WORKFLOW_NAME and --directory are mutually exclusive.") source = search_install_source_dirs(reg) flow_name = opts.flow_name or reg diff --git a/cylc/flow/scripts/kill.py b/cylc/flow/scripts/kill.py index 66a8149412d..1dce95d43a2 100755 --- a/cylc/flow/scripts/kill.py +++ b/cylc/flow/scripts/kill.py @@ -21,8 +21,8 @@ Kill running or submitted jobs. Examples: - $ cylc kill REG # kill all active tasks in the workflow - $ cylc kill REG TASK_GLOB ... # kill one or more active tasks + $ cylc kill WORKFLOW # kill all active tasks in the workflow + $ cylc kill WORKFLOW TASK_GLOB ... # kill one or more active tasks """ from typing import TYPE_CHECKING @@ -55,7 +55,7 @@ def get_option_parser(): parser = COP( __doc__, comms=True, multitask=True, argdoc=[ - ('REG', 'Workflow name'), + ('WORKFLOW', 'Workflow name or ID'), ('[TASK_GLOB ...]', 'Task matching patterns')]) return parser diff --git a/cylc/flow/scripts/message.py b/cylc/flow/scripts/message.py index 3d19de14275..2289ceeb163 100755 --- a/cylc/flow/scripts/message.py +++ b/cylc/flow/scripts/message.py @@ -90,7 +90,7 @@ def get_option_parser(): parser = COP( __doc__, comms=True, argdoc=[ - ('[REG]', 'Workflow name'), + ('[WORKFLOW]', 'Workflow name or ID'), ('[TASK-JOB]', 'Task job identifier CYCLE/TASK_NAME/SUBMIT_NUM'), ('[[SEVERITY:]MESSAGE ...]', 'Messages')]) parser.add_option( diff --git a/cylc/flow/scripts/pause.py b/cylc/flow/scripts/pause.py index 0c0c363f30c..c8c95529aab 100644 --- a/cylc/flow/scripts/pause.py +++ b/cylc/flow/scripts/pause.py @@ -57,7 +57,7 @@ def get_option_parser(): parser = COP( __doc__, comms=True, multitask=True, - argdoc=[('REG', "Workflow name")] + argdoc=[('WORKFLOW', 'Workflow name or ID')] ) return parser diff --git a/cylc/flow/scripts/ping.py b/cylc/flow/scripts/ping.py index 7e2366effb0..bf31ff78765 100755 --- a/cylc/flow/scripts/ping.py +++ b/cylc/flow/scripts/ping.py @@ -20,7 +20,7 @@ Test communication with a running workflow. -If workflow REG is running or TASK in workflow REG is currently running, +If workflow WORKFLOW is running or TASK in WORKFLOW is currently running, exit with success status, else exit with error status.""" from ansimarkup import parse as cparse @@ -65,7 +65,11 @@ def get_option_parser(): parser = COP( __doc__, comms=True, - argdoc=[('REG', 'Workflow name'), ('[TASK]', 'Task ' + TaskID.SYNTAX)]) + argdoc=[ + ('WORKFLOW', 'Workflow name or ID'), + ('[TASK]', 'Task ' + TaskID.SYNTAX) + ] + ) return parser diff --git a/cylc/flow/scripts/poll.py b/cylc/flow/scripts/poll.py index df153d1b32b..c7e0cd3be95 100755 --- a/cylc/flow/scripts/poll.py +++ b/cylc/flow/scripts/poll.py @@ -21,8 +21,8 @@ Poll (query) task jobs to verify and update their statuses. Examples: - $ cylc poll REG # poll all active tasks - $ cylc poll REG TASK_GLOB # poll multiple active tasks or families + $ cylc poll WORKFLOW # poll all active tasks + $ cylc poll WORKFLOW TASK_GLOB # poll multiple active tasks or families """ from typing import TYPE_CHECKING @@ -55,7 +55,7 @@ def get_option_parser(): parser = COP( __doc__, comms=True, multitask=True, argdoc=[ - ('REG', 'Workflow name'), + ('WORKFLOW', 'Workflow name or ID'), ('[TASK_GLOB ...]', 'Task matching patterns')] ) return parser diff --git a/cylc/flow/scripts/reinstall.py b/cylc/flow/scripts/reinstall.py index 8f63474071f..8f6c5b06a1c 100644 --- a/cylc/flow/scripts/reinstall.py +++ b/cylc/flow/scripts/reinstall.py @@ -58,7 +58,7 @@ def get_option_parser(): parser = COP( - __doc__, comms=True, argdoc=[('[REG]', 'Workflow name')] + __doc__, comms=True, argdoc=[('[WORKFLOW]', 'Workflow name or ID')] ) parser.add_cylc_rose_options() diff --git a/cylc/flow/scripts/release.py b/cylc/flow/scripts/release.py index b6ed2ec4fcf..cef6b07cd0c 100755 --- a/cylc/flow/scripts/release.py +++ b/cylc/flow/scripts/release.py @@ -84,7 +84,7 @@ def get_option_parser() -> COP: parser = COP( __doc__, comms=True, multitask=True, argdoc=[ - ('REG', "Workflow name"), + ('WORKFLOW', 'Workflow name or ID'), ('[TASK_GLOB ...]', "Task matching patterns")] ) diff --git a/cylc/flow/scripts/reload.py b/cylc/flow/scripts/reload.py index a92088d3867..4afebf4993f 100755 --- a/cylc/flow/scripts/reload.py +++ b/cylc/flow/scripts/reload.py @@ -26,8 +26,8 @@ a task is already running at reload time. If the workflow was started with Jinja2 template variables set on the command -line (cylc play --set 'FOO="bar"' REG) the same template settings apply to the -reload (only changes to the flow.cylc file itself are reloaded). +line (cylc play --set 'FOO="bar"' WORKFLOW) the same template settings apply to +the reload (only changes to the flow.cylc file itself are reloaded). If the modified workflow definition does not parse, failure to reload will be reported but no harm will be done to the running workflow.""" diff --git a/cylc/flow/scripts/remove.py b/cylc/flow/scripts/remove.py index ebb70588ed8..765a27c8604 100755 --- a/cylc/flow/scripts/remove.py +++ b/cylc/flow/scripts/remove.py @@ -52,7 +52,7 @@ def get_option_parser(): parser = COP( __doc__, comms=True, multitask=True, argdoc=[ - ("REG", "Workflow name"), + ("WORKFLOW", "Workflow name or ID"), ('TASK_GLOB [...]', 'Task matching patterns')]) return parser diff --git a/cylc/flow/scripts/report_timings.py b/cylc/flow/scripts/report_timings.py index 2ab57b6b3a3..7eaec3bae76 100755 --- a/cylc/flow/scripts/report_timings.py +++ b/cylc/flow/scripts/report_timings.py @@ -89,7 +89,7 @@ def smart_open(filename=None): def get_option_parser(): parser = COP( __doc__, - argdoc=[('REG', 'Workflow name')] + argdoc=[('WORKFLOW', 'Workflow name or ID')] ) parser.add_option( "-r", "--raw", diff --git a/cylc/flow/scripts/set_outputs.py b/cylc/flow/scripts/set_outputs.py index 070503f0b3c..5190207a599 100755 --- a/cylc/flow/scripts/set_outputs.py +++ b/cylc/flow/scripts/set_outputs.py @@ -58,7 +58,7 @@ def get_option_parser(): parser = COP( __doc__, comms=True, multitask_nocycles=True, argdoc=[ - ("REG", "Workflow name"), + ("WORKFLOW", "Workflow name or ID"), ('TASK-GLOB [...]', 'Task match pattern')]) parser.add_option( "--output", metavar="OUTPUT", diff --git a/cylc/flow/scripts/set_verbosity.py b/cylc/flow/scripts/set_verbosity.py index c5be32dccd0..868b82bdf59 100755 --- a/cylc/flow/scripts/set_verbosity.py +++ b/cylc/flow/scripts/set_verbosity.py @@ -52,7 +52,7 @@ def get_option_parser(): parser = COP( __doc__, comms=True, argdoc=[ - ('REG', 'Workflow name'), + ('WORKFLOW', 'Workflow name or ID'), ('LEVEL', ', '.join(LOG_LEVELS.keys())) ] ) diff --git a/cylc/flow/scripts/show.py b/cylc/flow/scripts/show.py index c83ca4cba9a..e51f474fd8b 100755 --- a/cylc/flow/scripts/show.py +++ b/cylc/flow/scripts/show.py @@ -21,9 +21,9 @@ Display workflow and task information. Query a running workflow for: - $ cylc show REG # workflow metadata - $ cylc show REG TASK_NAME # task metadata - $ cylc show REG TASK_GLOB # prerequisites and outputs of task instances + $ cylc show WORKFLOW # workflow metadata + $ cylc show WORKFLOW TASK_NAME # task metadata + $ cylc show WORKFLOW TASK_GLOB # prerequisites and outputs of task instances Prerequisite and output status is indicated for current active tasks. """ @@ -143,7 +143,7 @@ def get_option_parser(): parser = COP( __doc__, comms=True, multitask=True, argdoc=[ - ('REG', 'Workflow name'), + ('WORKFLOW', 'Workflow name or ID'), ('[TASK_NAME or TASK_GLOB ...]', 'Task names or match patterns')]) parser.add_option('--list-prereqs', action="store_true", default=False, diff --git a/cylc/flow/scripts/stop.py b/cylc/flow/scripts/stop.py index 85f14a25db3..fe9b6fcbf3a 100755 --- a/cylc/flow/scripts/stop.py +++ b/cylc/flow/scripts/stop.py @@ -112,7 +112,7 @@ def check(self): def get_option_parser(): parser = COP( __doc__, comms=True, - argdoc=[("REG", "Workflow name"), + argdoc=[("WORKFLOW", "Workflow name or ID"), ("[STOP]", "task POINT (cycle point), or TASK (task ID).")] ) diff --git a/cylc/flow/scripts/subscribe.py b/cylc/flow/scripts/subscribe.py index d77aca6cc02..674e79d7a8c 100755 --- a/cylc/flow/scripts/subscribe.py +++ b/cylc/flow/scripts/subscribe.py @@ -57,7 +57,7 @@ def get_option_parser(): parser = COP( __doc__, argdoc=[ - ('REG', 'Workflow name') + ('WORKFLOW_ID', 'Workflow ID') ], comms=True ) diff --git a/cylc/flow/scripts/trigger.py b/cylc/flow/scripts/trigger.py index b4edc9b9248..5a8f86017f4 100755 --- a/cylc/flow/scripts/trigger.py +++ b/cylc/flow/scripts/trigger.py @@ -20,8 +20,9 @@ Manually trigger tasks. Examples: - $ cylc trigger REG # trigger all tasks in a running workflow - $ cylc trigger REG TASK_GLOB ... # trigger some tasks in a running workflow + $ cylc trigger WORKFLOW # trigger all tasks in a running workflow + # trigger some tasks in a running workflow: + $ cylc trigger WORKFLOW TASK_GLOB ... NOTE waiting tasks that are queue-limited will be queued if triggered, to submit as normal when released by the queue; queued tasks will submit @@ -62,7 +63,7 @@ def get_option_parser(): parser = COP( __doc__, comms=True, multitask_nocycles=True, argdoc=[ - ('REG', 'Workflow name'), + ('WORKFLOW', 'Workflow name or ID'), ('[TASK_GLOB ...]', 'Task matching patterns')]) parser.add_option( diff --git a/cylc/flow/scripts/tui.py b/cylc/flow/scripts/tui.py index 788e0dc5f75..09263198a7c 100644 --- a/cylc/flow/scripts/tui.py +++ b/cylc/flow/scripts/tui.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -"""cylc tui REG +"""cylc tui WORKFLOW View and control running workflows in the terminal. @@ -53,7 +53,7 @@ def get_option_parser(): parser = COP( __doc__, argdoc=[ - ('REG', 'Workflow name') + ('WORKFLOW', 'Workflow name or ID') ], # auto_add=False, NOTE: at present auto_add can not be turned off color=False diff --git a/cylc/flow/scripts/workflow_state.py b/cylc/flow/scripts/workflow_state.py index 21ee65b0d0a..d87f557c3d4 100755 --- a/cylc/flow/scripts/workflow_state.py +++ b/cylc/flow/scripts/workflow_state.py @@ -35,15 +35,15 @@ mirrored workflow databases, use --run-dir=DIR to specify the location. Examples: - $ cylc workflow-state REG --task=TASK --point=POINT --status=STATUS + $ cylc workflow-state WORKFLOW --task=TASK --point=POINT --status=STATUS # returns 0 if TASK.POINT reaches STATUS before the maximum number of # polls, otherwise returns 1. - $ cylc workflow-state REG --task=TASK --point=POINT --status=STATUS \ + $ cylc workflow-state WORKFLOW --task=TASK --point=POINT --status=STATUS \ > --offset=PT6H # adds 6 hours to the value of CYCLE for carrying out the polling operation. - $ cylc workflow-state REG --task=TASK --status=STATUS --task-point + $ cylc workflow-state WORKFLOW --task=TASK --status=STATUS --task-point # uses CYLC_TASK_CYCLE_POINT environment variable as the value for the # CYCLE to poll. This is useful when you want to use cylc workflow-state in a # cylc task. @@ -128,7 +128,7 @@ def check(self): def get_option_parser() -> COP: parser = COP( __doc__, - argdoc=[('REG', "Workflow name")] + argdoc=[('WORKFLOW', "Workflow name or ID")] ) parser.add_option( @@ -150,7 +150,7 @@ def get_option_parser() -> COP: parser.add_option( "-d", "--run-dir", help="The top level cylc run directory if non-standard. The " - "database should be DIR/REG/log/db. Use to interrogate " + "database should be DIR/WORKFLOW_ID/log/db. Use to interrogate " "workflows owned by others, etc.; see note above.", metavar="DIR", action="store", dest="run_dir", default=None) diff --git a/tests/functional/clock-expire/00-basic/flow.cylc b/tests/functional/clock-expire/00-basic/flow.cylc index f36b24ba741..936c078484b 100644 --- a/tests/functional/clock-expire/00-basic/flow.cylc +++ b/tests/functional/clock-expire/00-basic/flow.cylc @@ -4,7 +4,7 @@ Skip a daily post-processing workflow if the 'copy' task has expired.""" [scheduler] - cycle point format = %Y-%m-%dT%H + # cycle point format = %Y-%m-%dT%H%M allow implicit tasks = True [[events]] abort on stall timeout = True diff --git a/tests/functional/cylc-install/00-simple.t b/tests/functional/cylc-install/00-simple.t index 035d763c382..ddbf44312da 100755 --- a/tests/functional/cylc-install/00-simple.t +++ b/tests/functional/cylc-install/00-simple.t @@ -40,23 +40,23 @@ popd || exit 1 purge_rnd_workflow # ----------------------------------------------------------------------------- -# Test default name: "cylc install REG" (flow in confgured source dir) +# Test default name: "cylc install WORKFLOW_NAME" (flow in confgured source dir) make_rnd_workflow # Before adding workflow to ~/cylc-src/, check install fails: -TEST_NAME="${TEST_NAME_BASE}-REG-fail-no-src-dir" +TEST_NAME="${TEST_NAME_BASE}-WORKFLOW_NAME-fail-no-src-dir" run_fail "${TEST_NAME}" cylc install "${RND_WORKFLOW_NAME}" # Now add workflow to ~/cylc-src/ RND_WORKFLOW_SOURCE="${PWD}/cylc-src/${RND_WORKFLOW_NAME}" mv "$RND_WORKFLOW_NAME" "${PWD}/cylc-src/" pushd "${RND_WORKFLOW_SOURCE}" || exit 1 -# Test REG and --directory are mutually exclusive -TEST_NAME="${TEST_NAME_BASE}-REG-and--directory-forbidden" +# Test WORKFLOW_NAME and --directory are mutually exclusive +TEST_NAME="${TEST_NAME_BASE}-WORKFLOW_NAME-and--directory-forbidden" run_fail "${TEST_NAME}" cylc install "${RND_WORKFLOW_NAME}" -C "${RND_WORKFLOW_SOURCE}" contains_ok "${TEST_NAME}.stderr" <<__ERR__ -cylc: error: REG and --directory are mutually exclusive. +cylc: error: WORKFLOW_NAME and --directory are mutually exclusive. __ERR__ # Finally test normal case -TEST_NAME="${TEST_NAME_BASE}-REG-install-ok" +TEST_NAME="${TEST_NAME_BASE}-WORKFLOW_NAME-install-ok" run_ok "${TEST_NAME}" cylc install "${RND_WORKFLOW_NAME}" contains_ok "${TEST_NAME}.stdout" <<__OUT__ INSTALLED $RND_WORKFLOW_NAME/run1 from ${RND_WORKFLOW_SOURCE} diff --git a/tests/functional/cylc-play/07-provided-vars.t b/tests/functional/cylc-play/07-provided-vars.t new file mode 100644 index 00000000000..0ccb6400954 --- /dev/null +++ b/tests/functional/cylc-play/07-provided-vars.t @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE. +# Copyright (C) NIWA & British Crown (Met Office) & Contributors. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +#------------------------------------------------------------------------ + +# test the export of CYLC_WORKFLOW_ID and CYLC_WORKFLOW_NAME + +. "$(dirname "$0")/test_header" + +set_test_number 4 + +cat > flow.cylc <<'__FLOW_CONFIG__' +[scheduler] + cycle point format = %Y + [[events]] + stall timeout = PT0S + +[scheduling] + initial cycle point = 1066 + + [[dependencies]] + R1 = foo + +[runtime] + [[foo]] + script = """ + echo "CYLC_WORKFLOW_NAME is: ${CYLC_WORKFLOW_NAME}" + echo "CYLC_WORKFLOW_ID is: ${CYLC_WORKFLOW_ID}" + """ +__FLOW_CONFIG__ + +init_workflow "${TEST_NAME_BASE}" flow.cylc true + +run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" +workflow_run_ok "${TEST_NAME_BASE}-play" cylc play "${WORKFLOW_NAME}" --no-detach +named_grep_ok \ + "${TEST_NAME_BASE}-check-CYLC_WORKFLOW_NAME" \ + "CYLC_WORKFLOW_NAME is:.* ${WORKFLOW_NAME}" \ + "${WORKFLOW_RUN_DIR}/runN/log/job/1066/foo/NN/job.out" +named_grep_ok \ + "${TEST_NAME_BASE}-check-CYLC_WORKFLOW_ID" \ + "CYLC_WORKFLOW_ID is:.* ${WORKFLOW_NAME}/run1" \ + "${WORKFLOW_RUN_DIR}/runN/log/job/1066/foo/NN/job.out" + diff --git a/tests/functional/lib/bash/test_header b/tests/functional/lib/bash/test_header index 77686102f15..d7ba6e2dc5b 100644 --- a/tests/functional/lib/bash/test_header +++ b/tests/functional/lib/bash/test_header @@ -73,10 +73,11 @@ # Test that FILE exists # exists_fail FILE # Test that FILE does not exist -# init_workflow TEST_NAME [SOURCE] +# init_workflow TEST_NAME [SOURCE] [[RUN_NUMS]] # Create a workflow from SOURCE's "flow.cylc" called: # "cylctb-${CYLC_TEST_TIME_INIT}/${TEST_SOURCE_DIR##*tests/}/${TEST_NAME}" # Provides WORKFLOW_NAME and WORKFLOW_RUN_DIR variables. +# RUN_NUMS (defaults to false): If false run cylc install --no-rundir # install_workflow TEST_NAME SOURCE # Same as init_workflow, but SOURCE must be a directory containing a # "flow.cylc" file. @@ -453,12 +454,17 @@ graph_workflow() { init_workflow() { local TEST_NAME="$1" local FLOW_CONFIG="${2:--}" + local RUN_NUMS="${3:-false}" WORKFLOW_NAME="${CYLC_TEST_REG_BASE}/${TEST_SOURCE_DIR_BASE}/${TEST_NAME}" WORKFLOW_RUN_DIR="${RUN_DIR}/${WORKFLOW_NAME}" mkdir -p "${TEST_DIR}/${WORKFLOW_NAME}/" cat "${FLOW_CONFIG}" >"${TEST_DIR}/${WORKFLOW_NAME}/flow.cylc" cd "${TEST_DIR}/${WORKFLOW_NAME}" - cylc install --no-run-name --flow-name="${WORKFLOW_NAME}" --directory="${TEST_DIR}/${WORKFLOW_NAME}" + if "${RUN_NUMS}"; then + cylc install --flow-name="${WORKFLOW_NAME}" --directory="${TEST_DIR}/${WORKFLOW_NAME}" + else + cylc install --no-run-name --flow-name="${WORKFLOW_NAME}" --directory="${TEST_DIR}/${WORKFLOW_NAME}" + fi } install_workflow() {