Skip to content

Commit

Permalink
test cylc#6398
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders authored and hjoliver committed Dec 10, 2024
1 parent cce3c8a commit da04357
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/functional/cylc-trigger/07-kill-trigger.t
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
# 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
22 changes: 22 additions & 0 deletions tests/functional/cylc-trigger/07-kill-trigger/flow.cylc
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 2 additions & 0 deletions tests/functional/cylc-trigger/07-kill-trigger/reference.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1/a -triggered off [] in flow 1
1/a -triggered off [] in flow 1

0 comments on commit da04357

Please sign in to comment.