Skip to content

Commit

Permalink
re-enable workflow mode = skip doing something useufl
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim committed Sep 4, 2024
1 parent 01caa43 commit 746d777
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
1 change: 0 additions & 1 deletion cylc/flow/cfgspec/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1339,7 +1339,6 @@ def get_script_common_text(this: str, example: Optional[str] = None):
Conf(
'run mode', VDR.V_STRING,
options=list(RunMode.OVERRIDING_MODES.value),
default=RunMode.LIVE.value,
desc=f'''
For a workflow run in live mode run this task in skip
mode.
Expand Down
38 changes: 25 additions & 13 deletions cylc/flow/task_job_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,14 +1009,21 @@ def _nonlive_submit_task_jobs(
workflow: str,
workflow_run_mode: str,
) -> 'Tuple[List[TaskProxy], List[TaskProxy]]':
"""Simulation mode task jobs submission.
"""Identify task mode and carry out alternative submission
paths if required:
* Simulation: Job submission.
* Skip: Entire job lifecycle happens here!
* Dummy: Pre-submission preparation (removing task scripts content)
before returning to live pathway.
* Live: return to main submission pathway without doing anything.
Returns:
lively_tasks:
A list of tasks which require subsequent
processing **as if** they were live mode tasks.
(This includes live and dummy mode tasks)
ghostly_tasks:
nonlive_tasks:
A list of tasks which require no further processing
because their apparent execution is done entirely inside
the scheduler. (This includes skip and simulation mode tasks).
Expand All @@ -1027,33 +1034,38 @@ def _nonlive_submit_task_jobs(
now = (now, get_time_string_from_unix_time(now))

for itask in itasks:
# Handle broadcasts:
# Get task config with broadcasts applied:
rtconfig = self.task_events_mgr.broadcast_mgr.get_updated_rtconfig(
itask)

# Apply task run mode
if workflow_run_mode in RunMode.NON_OVERRIDABLE_MODES.value:
# Task run mode cannot override workflow run-mode sim or dummy:
run_mode = workflow_run_mode
else:
# TODO - check whether this ever falls back on workflow run mode
run_mode = rtconfig['run mode'] or workflow_run_mode
# If workflow mode is skip or live and task mode is set,
# override workflow mode, else use workflow mode.
run_mode = rtconfig.get('run mode', None) or workflow_run_mode
# Store the run mode of the this submission:
itask.run_mode = run_mode
# Submit nonlive tasks, or add live-like tasks to list
# of tasks to put through live submission pipeline -
# We decide based on the output of the submit method:
is_done = False

# Submit nonlive tasks, or add live-like (live or dummy)
# tasks to list of tasks to put through live
# submission pipeline - We decide based on the output
# of the submit method:
is_nonlive = False
if run_mode == RunMode.DUMMY.value:
is_done = dummy_submit_task_job(
is_nonlive = dummy_submit_task_job(

Check warning on line 1058 in cylc/flow/task_job_mgr.py

View check run for this annotation

Codecov / codecov/patch

cylc/flow/task_job_mgr.py#L1058

Added line #L1058 was not covered by tests
self, itask, rtconfig, workflow, now)
elif run_mode == RunMode.SIMULATION.value:
is_done = simulation_submit_task_job(
is_nonlive = simulation_submit_task_job(
self, itask, rtconfig, workflow, now)
elif run_mode == RunMode.SKIP.value:
is_done = skip_submit_task_job(
is_nonlive = skip_submit_task_job(
self, itask, rtconfig, now)

# Assign task to list:
if is_done:
if is_nonlive:
nonlive_tasks.append(itask)
else:
lively_tasks.append(itask)
Expand Down
12 changes: 10 additions & 2 deletions tests/integration/run_modes/test_mode_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,16 @@ async def test_run_mode_override_from_config(

# Live task has been really submitted:
assert log_filter(log, contains=expect_template.format('live'))
# Default is the same as live:
assert log_filter(log, contains=expect_template.format('default'))

# Default is the same as workflow:
if workflow_run_mode == 'live':
assert log_filter(log, contains=expect_template.format('default'))
else:
assert log_filter(
log, contains='[1000/default_/01:running] => succeeded')
assert not log_filter(
log, contains=expect_template.format('default'))

# Skip task has run, but not actually been submitted:
assert log_filter(log, contains='[1000/skip_/01:running] => succeeded')
assert not log_filter(log, contains=expect_template.format('skip'))
Expand Down

0 comments on commit 746d777

Please sign in to comment.