#!jinja2
[cylc]
    UTC mode=True
    cycle point format = %Y
    [[events]]
        abort on stalled = True
        abort on inactivity = True
        inactivity = P1M
        startup handler = cylc release '%(suite)s'
[scheduling]
    initial cycle point = 2016
    final cycle point = 2020
    [[graph]]
        P1Y=t1[-P1Y] => t1
[runtime]
    [[t1]]
        script = """
wait "${CYLC_TASK_MESSAGE_STARTED_PID}" 2>/dev/null || true
if [[ "${CYLC_TASK_CYCLE_POINT}" == '2017' ]]; then
    cylc__job__poll_grep_suite_log -F \
        '[t1.2017] status=submitted: (received)started'
    sleep 2  # make sure status change recorded in DB
    cylc broadcast "${CYLC_SUITE_NAME}" -p '2017' -n 't1' --set='script=true'
    cylc hold "${CYLC_SUITE_NAME}"
    cylc__job__poll_grep_suite_log -F \
        'INFO - Command succeeded: hold_suite()'
    sleep 2
    (cd "${CYLC_SUITE_DEF_PATH}"; cp -p 'suite2.rc' 'suite.rc')
    cylc reload "${CYLC_SUITE_NAME}"
    cylc__job__poll_grep_suite_log 'Reload completed'
    cylc insert "${CYLC_SUITE_NAME}" 't2.2017'
    while ! cylc show "${CYLC_SUITE_NAME}" 't2.2017' 1>'/dev/null' 2>&1; do
        sleep 1  # make sure insert completes
    done
    sleep 2
    cylc release "${CYLC_SUITE_NAME}"
fi
"""
        [[[job]]]
            execution time limit = PT50S
        [[[events]]]
            failed handler = cylc release '%(suite)s'
