| 1 |
[scheduling] |
| 2 |
[[graph]] |
| 3 |
R1 = retry => test |
| 4 |
|
| 5 |
|
| 6 |
[runtime] |
| 7 |
[[retry]] |
| 8 |
# capture task info - incl xtriggers |
| 9 |
pre-script = """ |
| 10 |
cylc show "${CYLC_WORKFLOW_ID}" \ |
| 11 |
"${CYLC_TASK_NAME}.${CYLC_TASK_CYCLE_POINT}" \ |
| 12 |
> "${CYLC_TASK_LOG_ROOT}-show" |
| 13 |
""" |
| 14 |
|
| 15 |
# fail four times then pass |
| 16 |
script = test "${CYLC_TASK_SUBMIT_NUMBER}" -ge 5 |
| 17 |
|
| 18 |
# stagger retries every two seconds |
| 19 |
[[[job]]] |
| 20 |
execution retry delays = 5*PT3S |
| 21 |
|
| 22 |
|
| 23 |
[[test]] |
| 24 |
script = """ |
| 25 |
cylc cat-log "${CYLC_WORKFLOW_ID}" > log |
| 26 |
|
| 27 |
# get a list of the times cylc says tasks will retry after |
| 28 |
mapfile -t RETRY_TIMES \ |
| 29 |
< <(sed -n 's/.*retrying.*after \(.*\)).*/\1/p' log) |
| 30 |
|
| 31 |
# get a list of the times when the xtriggers actually succeeded |
| 32 |
mapfile -t XTRIGGER_TIMES \ |
| 33 |
< <(sed -n 's/\(.*\) INFO.*xtrigger succeeded.*/\1/p' log) |
| 34 |
|
| 35 |
test "${#RETRY_TIMES[@]}" -eq 4 |
| 36 |
test "${#XTRIGGER_TIMES[@]}" -eq 4 |
| 37 |
|
| 38 |
# make sure that tasks retried when they said they would |
| 39 |
for N in $(seq 0 3); do |
| 40 |
INTERVAL="$(isodatetime \ |
| 41 |
"${RETRY_TIMES[$N]}" "${XTRIGGER_TIMES[$N]}" --as-total s)" |
| 42 |
|
| 43 |
echo "RETRY=${RETRY_TIMES[$N]}" |
| 44 |
echo "XTRIGGER=${XTRIGGER_TIMES[$N]}" |
| 45 |
echo "INTERVAL=${INTERVAL}" |
| 46 |
python3 -c "assert ${INTERVAL} >= 0.0" |
| 47 |
done |
| 48 |
""" |