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 5 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
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Maintenance release.

### Fixes

[#5104](https://github.com/cylc/cylc-flow/pull/5104) - Fix retriggering of
failed tasks after a reload.

[#5119](https://github.com/cylc/cylc-flow/pull/5119) - Fix formatting of
deprecation warnings at validation.

Expand Down
3 changes: 3 additions & 0 deletions cylc/flow/task_job_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,10 @@ def _manip_task_jobs_callback(
tasks = {}
for itask in itasks:
while itask.reload_successor is not None:
# Note submit number could be incremented since reload.
subnum = itask.submit_num
itask = itask.reload_successor
itask.submit_num = subnum
if itask.point is not None and itask.submit_num:
submit_num = "%02d" % (itask.submit_num)
tasks[(str(itask.point), itask.tdef.name, submit_num)] = itask
Expand Down
12 changes: 4 additions & 8 deletions cylc/flow/task_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,10 @@ def stop_task_done(self):

def _swap_out(self, itask):
"""Swap old task for new, during reload."""
if itask.point in self.hidden_pool:
if itask.identity in self.hidden_pool[itask.point]:
self.hidden_pool[itask.point][itask.identity] = itask
self.hidden_pool_changed = True
elif (
itask.point in self.main_pool
and itask.identity in self.main_pool[itask.point]
):
if itask.identity in self.hidden_pool.get(itask.point, set()):
self.hidden_pool[itask.point][itask.identity] = itask
self.hidden_pool_changed = True
elif itask.identity in self.main_pool.get(itask.point, set()):
self.main_pool[itask.point][itask.identity] = itask
self.main_pool_changed = True

Expand Down
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