Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip Mode #6039

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1344836
Implement Skip Mode
wxtim Apr 25, 2024
c34bc64
Suggestions from review.
wxtim Sep 19, 2024
cb73b59
Ensure that platforms for skip and simulation contain default
wxtim Oct 3, 2024
24aef08
Simpler Suggestions from @metronnie
wxtim Oct 16, 2024
3e516a9
* Remove nonlive.py and move it's only function into skip.py
wxtim Oct 16, 2024
d751f0d
Unit tests and improved docs for parse_fail_cycle_points
wxtim Oct 16, 2024
c71ade2
Apply suggestions from code review
wxtim Oct 16, 2024
6582225
fix broken test
wxtim Oct 16, 2024
4165ee4
fix mypy failures
wxtim Oct 16, 2024
2a4b320
restored missing code
wxtim Oct 16, 2024
c407e7c
small ruff fixes
wxtim Oct 16, 2024
67cd776
re-added missing test
wxtim Oct 18, 2024
9333731
Type checking improved.
wxtim Oct 19, 2024
b51ff06
Update cylc/flow/task_outputs.py
wxtim Oct 21, 2024
d051fd1
fix outstanding broken test
wxtim Oct 23, 2024
509db85
undo some overzealous fixes to mypy.
wxtim Oct 23, 2024
31a753a
sort test parameters: Prevents distribution clashes
wxtim Oct 23, 2024
1f39b2c
restore error message on restarting in a different mode
wxtim Oct 23, 2024
7c38690
use Enum correctly in a test
wxtim Oct 23, 2024
0c5e639
Review suggestions
wxtim Oct 31, 2024
2ec57e9
remove un-needed check for itask.run_mode
wxtim Oct 31, 2024
51f6585
restore validate --run-mode
wxtim Oct 31, 2024
40183c3
doc changes
wxtim Oct 31, 2024
f9e8a83
Partially revert changes to `Prerequisite` (#64)
MetRonnie Nov 5, 2024
48c69fb
Apply suggestions from code review
wxtim Nov 12, 2024
6eaab2c
Merge remote-tracking branch 'upstream/master' into feature.skip_mode
wxtim Nov 12, 2024
0cc5b9e
fix merge
wxtim Nov 12, 2024
3f96ce7
remove now not needed taskdef.runmode infor
wxtim Nov 12, 2024
995ab27
Response to review
wxtim Nov 12, 2024
60a75b3
Clear up terminology (#66)
MetRonnie Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes.d/6039.feat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added a new task run mode "skip", which allows skipping of tasks in a running workflow as well as creation of dummy tasks as part of workflow design.
59 changes: 59 additions & 0 deletions cylc/flow/cfgspec/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@
from cylc.flow.platforms import (
fail_if_platform_and_host_conflict, get_platform_deprecated_settings,
is_platform_definition_subshell)
from cylc.flow.run_modes import RunMode
from cylc.flow.task_events_mgr import EventData
from cylc.flow.run_modes import TASK_CONFIG_RUN_MODES


# Regex to check whether a string is a command
REC_COMMAND = re.compile(r'(`|\$\()\s*(.*)\s*([`)])$')
Expand Down Expand Up @@ -1334,6 +1337,26 @@ def get_script_common_text(this: str, example: Optional[str] = None):
"[platforms][<platform name>]submission retry delays"
)
)
Conf(
'run mode', VDR.V_STRING,
options=list(TASK_CONFIG_RUN_MODES),
default=RunMode.LIVE.value,
desc=f'''
Run the task in one of the following modes:

{RunMode.LIVE.value}:
{RunMode.LIVE.describe()}
{RunMode.SKIP.value}:
{RunMode.SKIP.describe()}


.. seealso::

:ref:`task-run-modes`

.. versionadded:: 8.4.0

''')
with Conf('meta', desc=r'''
Metadata for the task or task family.

Expand Down Expand Up @@ -1406,7 +1429,43 @@ def get_script_common_text(this: str, example: Optional[str] = None):
determine how an event handler responds to task failure
events.
''')
with Conf('skip', desc='''
Task configuration for task :ref:`task-run-modes.skip`.

For a full description of skip run mode see
:ref:`task-run-modes.skip`.

.. versionadded:: 8.4.0
'''):
Conf(
'outputs',
VDR.V_STRING_LIST,
desc='''
Outputs to be emitted by a task in skip mode.

* By default, all required outputs will be generated
plus succeeded if success is optional.
* If skip-mode outputs is specified and does not
include either succeeded or failed then succeeded
will be produced.
* The outputs submitted and started are always
produced and do not need to be defined in outputs.

.. versionadded:: 8.4.0
'''
)
Conf(
'disable task event handlers',
VDR.V_BOOLEAN,
default=True,
desc='''
Task event handlers are turned off by default for
skip mode tasks. Changing this setting to ``False``
will re-enable task event handlers.

.. versionadded:: 8.4.0
'''
)
with Conf('simulation', desc='''
Task configuration for workflow *simulation* and *dummy* run
modes.
Expand Down
6 changes: 4 additions & 2 deletions cylc/flow/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@
from cylc.flow.log_level import log_level_to_verbosity
from cylc.flow.network.schema import WorkflowStopMode
from cylc.flow.parsec.exceptions import ParsecError
from cylc.flow.run_modes import RunMode
from cylc.flow.task_id import TaskID
from cylc.flow.task_state import TASK_STATUSES_ACTIVE, TASK_STATUS_FAILED
from cylc.flow.workflow_status import RunMode, StopMode
from cylc.flow.task_state import (
TASK_STATUSES_ACTIVE, TASK_STATUS_FAILED)
from cylc.flow.workflow_status import StopMode

from metomi.isodatetime.parsers import TimePointParser

Expand Down
21 changes: 12 additions & 9 deletions cylc/flow/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
)
from cylc.flow.print_tree import print_tree
from cylc.flow.task_qualifiers import ALT_QUALIFIERS
from cylc.flow.simulation import configure_sim_modes
from cylc.flow.run_modes.simulation import configure_sim_mode
from cylc.flow.run_modes.skip import skip_mode_validate
from cylc.flow.subprocctx import SubFuncContext
from cylc.flow.task_events_mgr import (
EventData,
Expand All @@ -99,6 +100,7 @@
get_trigger_completion_variable_maps,
trigger_to_completion_variable,
)
from cylc.flow.run_modes import RunMode
from cylc.flow.task_trigger import TaskTrigger, Dependency
from cylc.flow.taskdef import TaskDef
from cylc.flow.unicode_rules import (
Expand All @@ -114,7 +116,6 @@
WorkflowFiles,
check_deprecation,
)
from cylc.flow.workflow_status import RunMode
from cylc.flow.xtrigger_mgr import XtriggerCollator

if TYPE_CHECKING:
Expand Down Expand Up @@ -513,9 +514,10 @@ def __init__(

self.process_runahead_limit()

run_mode = self.run_mode()
run_mode = RunMode.get(self.options)
if run_mode in {RunMode.SIMULATION, RunMode.DUMMY}:
configure_sim_modes(self.taskdefs.values(), run_mode)
for taskdef in self.taskdefs.values():
configure_sim_mode(taskdef.rtconfig, None, False)

self.configure_workflow_state_polling_tasks()

Expand Down Expand Up @@ -567,6 +569,8 @@ def __init__(

self.mem_log("config.py: end init config")

skip_mode_validate(self.taskdefs)

@staticmethod
def _warn_if_queues_have_implicit_tasks(
config, taskdefs, max_warning_lines
Expand Down Expand Up @@ -1741,10 +1745,6 @@ def process_config_env(self):
]
)

def run_mode(self) -> str:
"""Return the run mode."""
return RunMode.get(self.options)

def _check_task_event_handlers(self):
"""Check custom event handler templates can be expanded.

Expand Down Expand Up @@ -2496,7 +2496,10 @@ def _get_taskdef(self, name: str) -> TaskDef:

# Get the taskdef object for generating the task proxy class
taskd = TaskDef(
name, rtcfg, self.run_mode(), self.start_point,
name,
rtcfg,
RunMode.get(self.options),
wxtim marked this conversation as resolved.
Show resolved Hide resolved
self.start_point,
self.initial_point)

# TODO - put all taskd.foo items in a single config dict
Expand Down
1 change: 1 addition & 0 deletions cylc/flow/data_messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ message PbRuntime {
optional string environment = 16;
optional string outputs = 17;
optional string completion = 18;
optional string run_mode = 19;
}


Expand Down
100 changes: 50 additions & 50 deletions cylc/flow/data_messages_pb2.py

Large diffs are not rendered by default.

Loading
Loading