[meta]
    title = "test that a reloaded retrying task does retry"
    description = """
        this requires some state vars to be carried over to the
        new task proxy; ref github #945
    """
[scheduling]
    [[graph]]
        R1 = retrier & reloader
[runtime]
    [[retrier]]
        script = """
            cylc__job__wait_cylc_message_started
            sleep 1
            if ((CYLC_TASK_TRY_NUMBER == 1)); then
                # Kill the job, so task will go into waiting (held)
                cylc kill "${CYLC_WORKFLOW_ID}//1/retrier"
                sleep 120  # Does not matter how long as the job will be killed
            fi
        """
        [[[job]]]
            execution retry delays = PT0S
    [[reloader]]
        script = """
            cylc__job__poll_grep_workflow_log -E '1/retrier/01:running\(held\).* => waiting\(held\)'
            cylc reload "${CYLC_WORKFLOW_ID}"
            cylc reload "${CYLC_WORKFLOW_ID}"
            cylc__job__poll_grep_workflow_log -F 'Reload completed'
            cylc release "${CYLC_WORKFLOW_ID}//1/retrier"
        """
