| 1 |
.. _examples.expiry: |
| 2 |
|
| 3 |
Expiring Tasks / Cycles |
| 4 |
----------------------- |
| 5 |
|
| 6 |
Cylc is often used to write workflows which monitor real-world events. |
| 7 |
|
| 8 |
For example, this workflow will run the task ``foo`` every day at 00:00am: |
| 9 |
|
| 10 |
.. code-block:: cylc |
| 11 |
|
| 12 |
[scheduling] |
| 13 |
initial cycle point = previous(T00) |
| 14 |
[[graph]] |
| 15 |
P1D = """ |
| 16 |
@wall_clock => foo |
| 17 |
""" |
| 18 |
|
| 19 |
Sometimes such workflows might get behind, e.g. due to failures or slow task |
| 20 |
execution. In this situation, it might be necessary to skip a few tasks in |
| 21 |
order for the workflow to catch up with the real-world time. |
| 22 |
|
| 23 |
Cylc has a concept called :ref:`expiry <ClockExpireTasks>` which allows tasks |
| 24 |
to be automatically "expired" if they are running behind schedule. The expiry |
| 25 |
can be configured as an offset from the cycle time. |
| 26 |
|
| 27 |
.. seealso:: |
| 28 |
|
| 29 |
:ref:`ClockExpireTasks`. |
| 30 |
|
| 31 |
|
| 32 |
Example 1: Skip a whole cycle of tasks |
| 33 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 34 |
|
| 35 |
If the workflow gets behind, skip whole cycles of tasks until it catches up. |
| 36 |
|
| 37 |
.. admonition:: Get a copy of this example |
| 38 |
:class: hint |
| 39 |
|
| 40 |
.. code-block:: console |
| 41 |
|
| 42 |
$ cylc get-resources examples/expiry/one |
| 43 |
|
| 44 |
.. literalinclude:: one/flow.cylc |
| 45 |
:language: cylc |
| 46 |
|
| 47 |
|
| 48 |
Example 2: Skip the remainder of a cycle of tasks |
| 49 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 50 |
|
| 51 |
If the workflow gets behind, skip the remainder of the tasks in the cycle, |
| 52 |
then skip whole cycles of tasks until it catches up. |
| 53 |
|
| 54 |
.. admonition:: Get a copy of this example |
| 55 |
:class: hint |
| 56 |
|
| 57 |
.. code-block:: console |
| 58 |
|
| 59 |
$ cylc get-resources examples/expiry/two |
| 60 |
|
| 61 |
.. literalinclude:: two/flow.cylc |
| 62 |
:language: cylc |
| 63 |
|
| 64 |
|
| 65 |
Example 3: Skip selected tasks in a cycle |
| 66 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 67 |
|
| 68 |
If the workflow gets behind, turn off selected tasks to allow it to catch up |
| 69 |
more quickly. |
| 70 |
|
| 71 |
.. admonition:: Get a copy of this example |
| 72 |
:class: hint |
| 73 |
|
| 74 |
.. code-block:: console |
| 75 |
|
| 76 |
$ cylc get-resources examples/expiry/three |
| 77 |
|
| 78 |
.. literalinclude:: three/flow.cylc |
| 79 |
:language: cylc |