#!Jinja2
[meta]
    title = Test: task should be held from retrying after a job kill
[scheduling]
    [[graph]]
        R1 = "sleeper:start => killer"
[runtime]
    [[killer]]
        script = """
            echo '# killing "sleeper"'
            cylc kill "${CYLC_SUITE_NAME}" "sleeper.1"
            cylc__job__poll_grep_suite_log -F \
                '[sleeper.1] -running => running (held)'
            cylc__job__poll_grep_suite_log -F \
                -F '[sleeper.1] -running (held) => retrying (held)'
            sleep 10  # sleep, should still be held after 10 seconds
            cylc dump -s -t "${CYLC_SUITE_NAME}" >'cylc-dump.out'
            diff -u 'cylc-dump.out' - <<'__OUT__'
            1, killer, running, spawned, unheld
            1, sleeper, retrying, spawned, held
            __OUT__
            cylc release "${CYLC_SUITE_NAME}" "sleeper.1"
        """
    [[sleeper]]
        script = """
        if ((CYLC_TASK_TRY_NUMBER == 1)); then
            sleep 120
        fi
        """
        [[[job]]]
            execution retry delays = PT1S
