Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test https://github.com/cylc/cylc-flow/issues/6398 #61

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading