title = Test: run task - hold suite - task job retry - release suite

[cylc]
    [[reference test]]
        live mode suite timeout = PT1M30S
        dummy mode suite timeout = PT1M30S
        simulation mode suite timeout = PT1M30S

[scheduling]
    [[dependencies]]
        graph = """
t-retry-able:start => t-hold
t-submit-retry-able:submit => t-hold
"""

[runtime]
    [[t-hold]]
        script = """
# Hold the suite
cylc hold "${CYLC_SUITE_NAME}"
timeout 15 my-log-grepper 'Command succeeded: hold_suite'
# Poll t-submit-retry-able, should return submit-fail
cylc poll "${CYLC_SUITE_NAME}" 't-submit-retry-able'
# Allow t-retry-able to continue
rm -f "${CYLC_SUITE_RUN_DIR}/file"
timeout 15 my-log-grepper '[t-retry-able.1] -running (held) => held (retrying)'
timeout 15 my-log-grepper \
    '[t-submit-retry-able.1] -submitted (held) => held (submit-retrying)'
# Release the suite
cylc release "${CYLC_SUITE_NAME}"
timeout 15 my-log-grepper '[t-retry-able.1] -held (retrying) => retrying'
timeout 15 my-log-grepper \
    '[t-submit-retry-able.1] -held (submit-retrying) => submit-retrying'
"""
    [[t-retry-able]]
        script = """
if ((CYLC_TASK_SUBMIT_NUMBER == 1)); then
    touch "${CYLC_SUITE_RUN_DIR}/file"
    while [[ -e "${CYLC_SUITE_RUN_DIR}/file" ]]; do
        sleep 1
    done
    false
fi
"""
        [[[job]]]
            execution retry delays = PT5S
    [[t-submit-retry-able]]
        env-script = """
if ((CYLC_TASK_SUBMIT_NUMBER == 1)); then
    trap '' EXIT
    exit
fi
"""
        script = true
        [[[job]]]
            submission retry delays = PT5S
