| 1 |
[meta] |
| 2 |
title = Converging Workflow |
| 3 |
description = """ |
| 4 |
A workflow which runs a pattern of tasks over and over until a |
| 5 |
convergence condition has been met. |
| 6 |
""" |
| 7 |
|
| 8 |
[scheduling] |
| 9 |
cycling mode = integer |
| 10 |
initial cycle point = 1 |
| 11 |
[[graph]] |
| 12 |
P1 = """ |
| 13 |
# run "increment" then check the convergence condition |
| 14 |
check_convergence[-P1]:not_converged? => increment => check_convergence |
| 15 |
|
| 16 |
# if the workflow has converged, then do nothing |
| 17 |
check_convergence:converged? |
| 18 |
""" |
| 19 |
|
| 20 |
[runtime] |
| 21 |
[[increment]] |
| 22 |
# a task which evolves the data |
| 23 |
[[check_convergence]] |
| 24 |
# a task which checks whether the convergence condition has been met |
| 25 |
script = """ |
| 26 |
if (( CYLC_TASK_CYCLE_POINT == 4 )); then |
| 27 |
# for the purpose of example, assume convergence at cycle point 4 |
| 28 |
cylc message -- 'convergence condition met' |
| 29 |
else |
| 30 |
cylc message -- 'convergence condition not met' |
| 31 |
fi |
| 32 |
""" |
| 33 |
[[[outputs]]] |
| 34 |
converged = 'convergence condition met' |
| 35 |
not_converged = 'convergence condition not met' |