| 1 |
#!Jinja2 |
| 2 |
|
| 3 |
[meta] |
| 4 |
title = task expire example workflow |
| 5 |
description = """ |
| 6 |
Skip a daily post-processing workflow if the 'copy' task has expired.""" |
| 7 |
|
| 8 |
[scheduler] |
| 9 |
cycle point format = %Y-%m-%dT%H |
| 10 |
allow implicit tasks = True |
| 11 |
cycle point time zone = {{CPTZ}} |
| 12 |
[[events]] |
| 13 |
abort on stall timeout = True |
| 14 |
stall timeout = PT1M |
| 15 |
[scheduling] |
| 16 |
initial cycle point = now |
| 17 |
final cycle point = +P3D |
| 18 |
[[special tasks]] |
| 19 |
clock-expire = copy(-P1DT1H) |
| 20 |
# NOTE this would normally be copy(P1D) i.e. expire if more than 1 day |
| 21 |
# behind the wall clock, but here we have to start from 'now' in order |
| 22 |
# to stay near the wall clock, so expire the task if more than 1 day |
| 23 |
# behind "now + 1 day". This makes the first two 'copy' tasks expire. |
| 24 |
[[graph]] |
| 25 |
P1D = """ |
| 26 |
model[-P1D] => model => copy? => proc |
| 27 |
copy:expired? => !proc |
| 28 |
""" |
| 29 |
[runtime] |
| 30 |
[[root]] |
| 31 |
script = true |
| 32 |
[[copy]] |
| 33 |
script = """ |
| 34 |
# Abort if I run in either of the first two cycle points. |
| 35 |
test "${CYLC_TASK_CYCLE_POINT}" != "${CYLC_WORKFLOW_INITIAL_CYCLE_POINT}" |
| 36 |
P2D="$(cylc cyclepoint --offset='P1D' "${CYLC_WORKFLOW_INITIAL_CYCLE_POINT}")" |
| 37 |
test "${CYLC_TASK_CYCLE_POINT}" != "${P2D}" |
| 38 |
""" |