Skip to content

Group trigger #6395

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Group trigger #6395

wants to merge 12 commits into from

Conversation

hjoliver
Copy link
Member

@hjoliver hjoliver commented Oct 6, 2024

[UPDATED and refactored post informal agreement on the proposal]


Major change to manual trigger behaviour: instead of running all target tasks immediately despite unsatisfied prerequisites, trigger them as a group that respects in-group dependencies and ignores off-group prerequisites that would cause a stall.

This is an easier way to (re)run a sub-graph when all the tasks can easily be identified - no need to manually identify sub-graph start tasks to trigger and/or set off-flow prerequisites.

(Amazingly, this should not be a breaking change for any sensible cylc trigger use cases).

High level implementation (see the the proposal for details):

  1. Examine the group to identify all off-group prerequisites
  2. Remove the (original or specified) flow from group tasks, to allow rerun in the same flow
  3. Satisfy the off-group prerequisites, to trigger group start tasks and prevent later stalls
  4. (The resulting flow then takes care of itself to propagate through the group)

Example from the proposal, tweaked to run automatically via a stall handler:

# Task b fails due to an upstream problem not captured by the workflow
# so we need to rerun the graph from task a, to complete the workflow.
[scheduler]
    [[events]]
        expected task failures = 1/b
        stall handlers = \
            "cylc trigger %(workflow)s \
             //1/a //1/f_m1 //1/f_m2 //1/f_m3 //1/g_m1 //1/g_m2 //1/g_m3 //1/b"
[scheduling]
    [[graph]]
        R1 = """
            start => a
            x => f_m1
            a => f_m1 => g_m1 => b
            a => f_m2 => g_m2 => b
            a => f_m3 => g_m3 => b
            b => end
            g_m3 => y
       """
[runtime]
    [[b]]
        script = [[ "${CYLC_TASK_SUBMIT_NUMBER}" != '1' ]]
    [[FAMILY]]  # (anticipates inactive tasks globbing to specify a trigger group)
    [[a, f_m1, f_m2, f_m3, g_m1, g_m2, g_m3, b]]
        inherit = FAMILY
    [[start, x, end, y]]

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • Changelog entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@hjoliver hjoliver self-assigned this Oct 6, 2024
@hjoliver hjoliver added this to the 8.5.0 milestone Dec 3, 2024
@hjoliver hjoliver force-pushed the group-trigger branch 2 times, most recently from f17c360 to 60ae2e5 Compare December 20, 2024 01:28
@hjoliver
Copy link
Member Author

Note on changes to reference logs: group trigger causes triggering by satisfying prerequisites, rather than by direct triggering despite unsatisfied prerequisites ... so triggering now gets logged as (e.g.) 1/b triggered off ['1/a'] instead of 1/b triggered off [ ].

@hjoliver hjoliver force-pushed the group-trigger branch 2 times, most recently from dc67098 to 244d191 Compare December 20, 2024 03:55
@hjoliver hjoliver force-pushed the group-trigger branch 3 times, most recently from 85cd3a1 to a86dede Compare January 15, 2025 03:48
@hjoliver hjoliver marked this pull request as ready for review February 27, 2025 11:08
@hjoliver hjoliver marked this pull request as draft March 24, 2025 00:30
@hjoliver

This comment was marked as resolved.

@hjoliver hjoliver force-pushed the group-trigger branch 8 times, most recently from 8805498 to ea337a4 Compare April 8, 2025 05:59
@oliver-sanders

This comment was marked as resolved.

@hjoliver hjoliver force-pushed the group-trigger branch 2 times, most recently from da19792 to 5eb4de7 Compare May 9, 2025 01:18
@hjoliver
Copy link
Member Author

hjoliver commented May 9, 2025

Integrated xtrigger prerequisite setting. Tested with this:

[scheduling]
    [[xtriggers]]
        xoff = xrandom(0)  # never
    [[graph]]
        R1 = """
            failer? => a => b & c => cleanup
            failer:fail? => triggerer
            off => c  # off-group task prerequisite
            @xoff => b  # off-group xtrigger prerequisite
        """
[runtime]
    [[failer, off]]
        script = false
    [[a, b, c]]
    [[triggerer]]
        script = "cylc trigger $CYLC_WORKFLOW_ID //1/a //1/b //1/c"
    [[cleanup]]
        script = "cylc remove $CYLC_WORKFLOW_ID//1/*:failed"

From the log:

...
INFO - Command "force_trigger_tasks" received. ID=84ed8d79-e1f6-47c6-b55a-5cf53fb1e950
    force_trigger_tasks(flow=[], flow_wait=False, on_resume=False, tasks=['1/a', '1/b', '1/c'])
INFO - [1/b:waiting(runahead)] prerequisite force-satisfied: xoff = xrandom(0)
INFO - [1/c:waiting(runahead)] prerequisite force-satisfied: 1/off:succeeded
INFO - [1/a:waiting(runahead)] prerequisite force-satisfied: 1/failer:succeeded
INFO - [1/a:waiting(runahead)] => waiting
INFO - [1/b:waiting(runahead)] => waiting
INFO - [1/c:waiting(runahead)] => waiting
INFO - Command "force_trigger_tasks" actioned. ID=84ed8d79-e1f6-47c6-b55a-5cf53fb1e950
...

@hjoliver hjoliver force-pushed the group-trigger branch 5 times, most recently from d888397 to babcc14 Compare May 13, 2025 03:08
hjoliver added 9 commits May 13, 2025 03:10
commit efe0a744ce3acf2e33344cc81ea039565b10a171
Author: Hilary James Oliver <hilary.j.oliver@gmail.com>
Date:   Tue Apr 8 02:50:47 2025 +0000

    Remove an unused method.

commit e8a17d85ff8efe6ce166d4b6dc49b7786d10da69
Author: Hilary James Oliver <hilary.j.oliver@gmail.com>
Date:   Tue Apr 8 02:48:22 2025 +0000

    Update change log.

commit 91e09f2
Author: Hilary James Oliver <hilary.j.oliver@gmail.com>
Date:   Tue Apr 8 01:27:18 2025 +0000

    Update a func test.

commit cbc1050
Merge: 0d9e089 50980d5
Author: Hilary James Oliver <hilary.j.oliver@gmail.com>
Date:   Tue Apr 8 12:58:28 2025 +1200

    Merge branch 'master' into group-trigger

commit 0d9e089
Author: Hilary James Oliver <hilary.j.oliver@gmail.com>
Date:   Tue Apr 8 00:50:54 2025 +0000

    Add new unit test.

commit 3668abe
Author: Hilary James Oliver <hilary.j.oliver@gmail.com>
Date:   Tue Apr 8 08:45:41 2025 +1200

    Minor tweaks.

commit c522859
Author: Hilary James Oliver <hilary.j.oliver@gmail.com>
Date:   Tue Apr 8 08:37:14 2025 +1200

    Tweak change log entry.

commit 7efc653
Author: Hilary James Oliver <hilary.j.oliver@gmail.com>
Date:   Mon Apr 7 17:45:06 2025 +1200

    Post merge fix.

commit b002426
Merge: 3c68193 9ed2014
Author: Hilary James Oliver <hilary.j.oliver@gmail.com>
Date:   Mon Apr 7 03:29:05 2025 +0000

    Merge branch 'master' into group-trigger

commit 3c68193
Author: Hilary James Oliver <hilary.j.oliver@gmail.com>
Date:   Mon Mar 31 09:59:42 2025 +1300

    Tidy code. [skip ci]

commit 9445328
Author: Hilary James Oliver <hilary.j.oliver@gmail.com>
Date:   Fri Mar 28 17:03:03 2025 +1300

    Squashed commit of group-trigger development.

Tweak group trigger.

tweak
@hjoliver hjoliver force-pushed the group-trigger branch 5 times, most recently from 59a87e4 to 2a68d89 Compare May 13, 2025 04:17
@hjoliver
Copy link
Member Author

hjoliver commented May 13, 2025

TODO:

  • code tidied and TODOs addressed
  • manual testing against the proposal
  • test for xtrigger prequisite satisfaction in a group trigger operation
  • replace tests/f/cylc-trigger/08-group-trigger with integration tests

@hjoliver hjoliver force-pushed the group-trigger branch 2 times, most recently from 005f754 to db85246 Compare May 14, 2025 01:00
@hjoliver
Copy link
Member Author

Done.

@wxtim
Copy link
Member

wxtim commented May 15, 2025

Looks like something is going consistently wrong with 3.7?

@hjoliver
Copy link
Member Author

hjoliver commented May 15, 2025

All tests passed on rerun today - maybe you just need to reload your browser to show up to date results?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants