cylc / cylc-flow

Cylc: a workflow engine for cycling systems.
https://cylc.github.io
GNU General Public License v3.0
335 stars 94 forks source link

no-spawn on `set` of parentless sequential xtriggered task #6447

Closed dwsutherland closed 4 weeks ago

dwsutherland commented 1 month ago

Description

When setting the outputs on a parentless sequential xtriggered task, the next occurrence is not spawned.

Reproducible Example

Take this workflow, whose task is waiting on and xtrigger:

[scheduler]
    cycle point format = CCYYMMDDThh
    allow implicit tasks = True
[scheduling]
    initial cycle point = 20241017T22
    [[xtriggers]]
        clock_P5Y = wall_clock(offset=P5Y):PT20S
    [[graph]]
        T-00 = """
@clock_P5Y => a
"""
[runtime]
    [[root]]
        script = sleep $((1 + $RANDOM % 10))

if you use cylc set on a, the task will disappear and workflow shutdown:

.
.
.
2024-10-24T14:40:26+13:00 INFO - Cylc version: 8.3.6.dev
2024-10-24T14:40:26+13:00 INFO - Run mode: live
2024-10-24T14:40:26+13:00 INFO - Initial point: 20241017T22
2024-10-24T14:40:26+13:00 INFO - Final point: None
2024-10-24T14:40:26+13:00 INFO - Cold start from 20241017T22
2024-10-24T14:40:26+13:00 INFO - New flow: 1 (original flow from 20241017T22) 2024-10-24T14:40:26
2024-10-24T14:40:26+13:00 INFO - [20241017T22/a:waiting(runahead)] => waiting
2024-10-24T14:40:47+13:00 INFO - Command "set" received. ID=b961fa74-f88c-41e1-bbfc-bfed7bc81966
    set(flow=[], flow_wait=False, tasks=['20241017T22/a'])
2024-10-24T14:40:47+13:00 INFO - [20241017T22/a:waiting] setting implied output: submitted
2024-10-24T14:40:47+13:00 INFO - [20241017T22/a:waiting] setting implied output: started
2024-10-24T14:40:47+13:00 INFO - [20241017T22/a:waiting] => succeeded
2024-10-24T14:40:47+13:00 INFO - Command "set" actioned. ID=b961fa74-f88c-41e1-bbfc-bfed7bc81966
2024-10-24T14:40:47+13:00 INFO - Workflow shutting down - AUTOMATIC
2024-10-24T14:40:48+13:00 INFO - DONE

Expected Behaviour

The task should be spawned into the future/next-occurrence, as if the xtrigger was satisfied.

dwsutherland commented 1 month ago

Solution is probably to spawn next instance on perhaps any use of set on the task.. As if the xtrigger was satisfied and the task produced that output.. Being parentless means setting prerequisites is irrelevant, i.e. this graph:

    [[graph]]
        T-00 = """
@clock_P5Y => a
"""
        T01, T03, T05, T07, T09, T11, T13, T15, T17, T19, T21, T23 = """
@wall_clock => z
z => a => b
"""

Will remove the even hours, but the odd hour as are spawned by z

dwsutherland commented 1 month ago

Fix up: https://github.com/cylc/cylc-flow/pull/6448

An easier workflow to visualize is:

[scheduler]
    cycle point format = CCYYMMDDThh
    allow implicit tasks = True
[scheduling]
    initial cycle point = 20241017T22
    [[xtriggers]]
        clock_P5Y = wall_clock(offset=P5Y):PT20S
    [[graph]]
        T-00 = """
@clock_P5Y => a => b
b[-PT1H] => b
"""
[runtime]
    [[root]]
        script = sleep $((1 + $RANDOM % 10))

w/o this change the workflow shuts down when setting a as above.. with this change b kicks off and a is spawned forward.