Skip to content

Commit

Permalink
Merge pull request #808 from cylc/8.4.x-sync
Browse files Browse the repository at this point in the history
🤖 Merge 8.4.x-sync into master
  • Loading branch information
oliver-sanders authored Feb 25, 2025
2 parents 6e1ef95 + 8e61485 commit 430a971
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 16 deletions.
10 changes: 5 additions & 5 deletions src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@
('py:class', 'SubFuncContext'),
('py:exc', 'ISO8601SyntaxError'),
('py:exc', 'StrftimeSyntaxError'),
('py:class', 'ResponseDict'),
]
nitpick_ignore_regex = [
# intersphinx has trouble with pyzmq classes:
('py:class', r'zmq\.asyncio\.\w+')
]

# List of patterns, relative to source directory, that match files and
Expand All @@ -164,11 +169,6 @@
'https?://matrix.to/.*#.*',
]

nitpick_ignore_regex = [
# intersphinx has trouble with pyzmq classes:
('py:class', r'zmq\.asyncio\.\w+')
]

# -- Options for Slides output ----------------------------------------------

slide_theme = 'single-level'
Expand Down
82 changes: 71 additions & 11 deletions src/user-guide/writing-workflows/scheduling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1507,14 +1507,62 @@ to the task cycle point.
Clock-Expire Triggers
^^^^^^^^^^^^^^^^^^^^^

Tasks can be configured to :term:`expire <expired task>` if the wall clock
time exceeds some offset from their cycle point.
Tasks can be configured to :term:`expire <expired task>` if the real-world
(wall clock) time exceeds some offset from their cycle point.

Task expiration is configured with
:cylc:conf:`[scheduling][special tasks]clock-expire` using a syntax like
:cylc:conf:`clock-trigger <[scheduling][special tasks]clock-trigger>`
with a datetime offset relative to cycle point.
The offset should be positive to make the task expire if the wallclock time
has gone beyond the cycle point.

In this example:

* The task ``foo`` is configured to expire when the wall clock
time passes the cycle time:
* Whereas ``bar`` is configured to expire one hour *after* the cycle time.

.. code-block:: cylc
The associated ``:expire`` :term:`output <task output>` can be used to
[scheduling]
[[special tasks]]
clock-expire = foo, bar(PT1H)
So, in the cycle ``2000-01-01T00:00Z``:

* ``foo`` would expire at ``2000-01-01T00:00Z``.
* ``bar`` would expire at ``2000-01-01T01:00Z``.

Only waiting tasks can expire, :term:`active tasks <active>` will not be
killed if they pass their configured ``clock-expire`` time.

When a task expires, it produces the ``expired`` :term:`output`.
This can be used to
trigger other tasks. It must be marked as an :term:`optional output`,
i.e. expiry cannot be :term:`required <required output>`.

In this example:

* ``foo`` will not run before the wall clock time.
* ``foo`` will expire if it does not start running within 6 hours of the wall
clock time being reached.
* If ``foo`` runs, the task ``bar`` will run after.
* If ``foo`` expires, the task ``baz`` will run after.

.. code-block:: cylc
[scheduling]
initial cycle point = 2000
[[special tasks]]
clock-expire = foo(PT6H)
[[graph]]
P1D = """
@wall_clock => foo
foo => bar
foo:expired? => baz
"""
Family triggers are also provided for task expiry:

.. code-block:: cylc-graph
Expand All @@ -1523,19 +1571,31 @@ Family triggers are also provided for task expiry:
FAM:expire-all? => baz
FAM:expire-any? => qux
Task expiration is configured with
:cylc:conf:`[scheduling][special tasks]clock-expire` using a syntax like
:cylc:conf:`clock-trigger <[scheduling][special tasks]clock-trigger>`
with a datetime offset relative to cycle point.

The offset should be positive to make the task expire if the wallclock time
has gone beyond the cycle point.

.. warning::

The scheduler can only determine that a task has expired once it
enters the :term:`n=0 window <n-window>`.

This means that at least one of a task's prerequisites must be satisfied
before the task may expire.

So in the following example, the task ``b`` will only expire, **after**
the task ``a`` has succeeded:

.. code-block:: cylc
[scheduling]
initial cycle point = 2000
[[special tasks]]
clock-expire = b
[[graph]]
P1D = a => b
.. seealso::

For worked examples of workflows that use expiry, see the
:ref:`examples section<examples.expiry>`.


.. _WorkflowConfigExternalTriggers:

Expand Down

0 comments on commit 430a971

Please sign in to comment.