Skip to content

xtriggers: implement as a run mode #7231

@oliver-sanders

Description

@oliver-sanders

Implement xtriggers as a task "run mode" rather than a scheduler service.

(write up of #3497 (comment))

Xtriggers Vs Polling Tasks

At present, xtriggers are essentially syntax sugar for polling tasks.

E.g this:

[scheduling]
  [[xtriggers]]
    poller1 = poller(file="file1", cycle="%(cycle)s", sequential=False)
    poller2 = poller(file="file2", cycle="%(cycle)s", sequential=False)
  [[graph]]
    P1D = @poller1 => x
    P1M = @poller2 => y

Is equivalent to this:

[scheduling]
  [[graph]]
    P1D = poller1 => x
    P1M = poller2[-P1M] => poller2 => y

At present, poller tasks can do everything that xtriggers can, but xtriggers (as a more simplified abstraction) cannot do everything that polling tasks, e.g, some graphing limitations of xtriggers:

# conditional expressions
@a | @b => c

# expire-triggers
@x => x & !@y & !y
@y => y & !@x & !x

# multiple outputs
@poller:file1 => x
@poller:file2 => y
@poller:file3 => z

Problems With The Status Quo

Because xtriggers are a parallel implementation to tasks, we have to implement much of the infrastructure they require in parallel too.

E.g:

  • Bespoke interfaces for viewing and setting xtrigger prerequistes (duplicates task prerequisites).
  • Bespoke sequential spawning mechanism (alternative non SoD spawning mechanism).
  • Bespoke interface for xtrigger configuration (duplicates [runtime] functionality).

This causes maintenance burden and makes the situation more complex for users who need to learn the nuances of these two parallel systems. It would be simpler if we could reduce this down to a single implementation.

But beyond that, it also means that xtriggers are not able take advantage of task features which might be desirable.

We could attempt to develop a bespoke implementation to satisfy each of these missing interfaces, or, we could implement xtriggers as tasks and get all of this for free.

Xtriggers As Tasks

Basically, keep xtriggers functionally the same, but change the way they are defined / implemented so we can remove the bespoke interfaces straightening out the internals of Cylc.

We now have the "run mode" abstraction in Cylc which means that we can develop new task submission methods. E.g, it would be possible to implement async xtriggers as a "run mode".

Configure the task to use this run_mode and it automatically becomes an xtrigger.

I.e, this:

[scheduling]
  [[xtriggers]]
    poll_foo = poller(cycle="%(cycle)s", file="foo")
  [[graph]]
    P1D = @poll_foo => bar

Could be turned into this:

[scheduling]
  [[graph]]
    P1D = @poll_foo => bar

[runtime]
  [[@poll_foo]]
    run_mode = xtrigger
    script = poller
    [[[environment]]]
        FILE = foo

Unlocked Workflow Design Patterns

Chained xtriggers:

@foo => @bar => baz

Graph branching:

@foo | @bar => baz

Control over xtrigger spawning:

@wall_clock => @foo => bar

$ext-trigger => @foo => bar

Xtrigger expiry:

[scheduling]
  [[special tasks]]
    expire-triggers = @foo
  [[graph]]
    P1D = @foo => bar

Xtrigger time limits:

[runtime]
  [[@foo]]
    run mode = xtrigger
    execution time limit = PT1H

Configurable xtriggers:

$ cylc broadcast <workflow> -n POLLERS -s '[environment]PLATFORM = hpc-live'

Multi-file pollers:

@poller:file1 => file1
@poller:file2 => file2
@poller:file3? => file3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions