diff --git a/tests/functional/cylc-trigger/07-kill-trigger.t b/tests/functional/cylc-trigger/07-kill-trigger.t new file mode 100644 index 00000000000..23ae84a6f37 --- /dev/null +++ b/tests/functional/cylc-trigger/07-kill-trigger.t @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE. +# Copyright (C) NIWA & British Crown (Met Office) & Contributors. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +#------------------------------------------------------------------------------- +# Test killing a job, then re-triggering it whilst it is "held". +# See https://github.com/cylc/cylc-flow/issues/6398 + +. "$(dirname "$0")/test_header" + +set_test_number 2 + +install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}" + +run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" + +workflow_run_ok "${TEST_NAME_BASE}-run" \ + cylc play --debug --no-detach "${WORKFLOW_NAME}" + +purge diff --git a/tests/functional/cylc-trigger/07-kill-trigger/flow.cylc b/tests/functional/cylc-trigger/07-kill-trigger/flow.cylc new file mode 100644 index 00000000000..f0e6dbaefd6 --- /dev/null +++ b/tests/functional/cylc-trigger/07-kill-trigger/flow.cylc @@ -0,0 +1,22 @@ +[scheduler] + [[events]] + inactivity timeout = PT1M + +[scheduling] + [[graph]] + R1 = a + +[runtime] + [[a]] + script = """ + if [[ $CYLC_TASK_SUBMIT_NUMBER == 1 ]]; then + # wait for the scheduler to receive the started message, + # then kill the job + cylc__job__poll_grep_workflow_log -E '1/a.*running' + cylc kill "${CYLC_WORKFLOW_ID}//1/a" + fi + """ + [[[events]]] + # when the scheduler receives the failed message, trigger the task + # to run again, it should run instantly + failed handlers = cylc trigger "%(workflow)s//1/a" diff --git a/tests/functional/cylc-trigger/07-kill-trigger/reference.log b/tests/functional/cylc-trigger/07-kill-trigger/reference.log new file mode 100644 index 00000000000..4176c633d2e --- /dev/null +++ b/tests/functional/cylc-trigger/07-kill-trigger/reference.log @@ -0,0 +1,2 @@ +1/a -triggered off [] in flow 1 +1/a -triggered off [] in flow 1