#!jinja2
[cylc]
    [[events]]
        abort if any task fails = True
        timeout = PT2M
        abort on timeout = True
[scheduling]
    [[graph]]
            R1 = """
t-remote:start => t-shutdown
t-shutdown => t-remote-2
t-shutdown => t-check-log
"""
[runtime]
    [[t-remote]]
        script = """
# Hang the task on a remote host for up to 30 seconds
touch 'file'
timeout 30 bash -c 'while [[ -e 'file' ]]; do sleep 1; done' || true
"""
        [[[remote]]]
            host = {{environ['CYLC_TEST_HOST']}}
    [[t-shutdown]]
        script = """
# Shutdown and wait
cylc shutdown --now --max-polls=10 --interval=1 "${CYLC_SUITE_NAME}"
"""
    [[t-remote-2]]
        script = """
# Release t-remote-1
rm -f "${CYLC_SUITE_WORK_DIR}/${CYLC_TASK_CYCLE_POINT}/t-remote/file"
"""
        [[[remote]]]
            host = {{environ['CYLC_TEST_HOST']}}
    [[t-check-log]]
        script = """
            grep -q 'ERROR - garbage: initialisation did not complete' \
                "${CYLC_SUITE_LOG_DIR}/log"
            cylc shutdown --now "${CYLC_SUITE_NAME}"
"""
