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

Fix post-reload trigger. #5104

Merged
merged 7 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
26 changes: 26 additions & 0 deletions tests/functional/reload/27-stall-retrigger.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/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 retriggering a failed task after fixing the bug and reloading.
# It should run correctly with the updated settings.

# https://github.com/cylc/cylc-flow/issues/5103

. "$(dirname "$0")/test_header"
set_test_number 2
reftest
13 changes: 13 additions & 0 deletions tests/functional/reload/27-stall-retrigger/bin/stall-handler.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Change "script = false" -> "true" in 1/foo, then reload and retrigger it.

if grep "\[command\] reload_workflow" "${CYLC_WORKFLOW_LOG_DIR}/log" >/dev/null; then
# Abort if not the first call (avoid an endless loop if the reload does not
# have the intended effect).
cylc stop --now --now "${CYLC_WORKFLOW_ID}"
exit 1
fi
sed -i "s/false/true/" "${CYLC_WORKFLOW_RUN_DIR}/flow.cylc"
cylc reload "${CYLC_WORKFLOW_ID}"
cylc trigger "${CYLC_WORKFLOW_ID}//1/foo"
13 changes: 13 additions & 0 deletions tests/functional/reload/27-stall-retrigger/flow.cylc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Use a stall handler to fix and reload the workflow config, then retrigger the
# failed task, which should run successfully with the new settings.
[scheduler]
[[events]]
stall handlers = stall-handler.sh
expected task failures = 1/foo
[scheduling]
[[graph]]
R1 = "foo => bar"
[runtime]
[[foo]]
script = false
[[bar]]
3 changes: 3 additions & 0 deletions tests/functional/reload/27-stall-retrigger/reference.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1/foo -triggered off [] in flow 1
1/foo -triggered off [] in flow 1
1/bar -triggered off ['1/foo'] in flow 1