| 1 |
#!/bin/bash |
| 2 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE. |
| 3 |
# Copyright (C) NIWA & British Crown (Met Office) & Contributors. |
| 4 |
# |
| 5 |
# This program is free software: you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation, either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
#------------------------------------------------------------------------------- |
| 18 |
|
| 19 |
# GitHub 5067: if a task is removed from the graph after shutdown, it should not |
| 20 |
# cause an error at restart. If it was a failed incomplete task, however, it |
| 21 |
# should still be polled and logged at restart. |
| 22 |
|
| 23 |
. "$(dirname "$0")/test_header" |
| 24 |
|
| 25 |
set_test_number 7 |
| 26 |
|
| 27 |
install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}" |
| 28 |
|
| 29 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate --set="INCL_B_C=True" "${WORKFLOW_NAME}" |
| 30 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate --set="INCL_B_C=False" "${WORKFLOW_NAME}" |
| 31 |
|
| 32 |
TEST_NAME="${TEST_NAME_BASE}-run" |
| 33 |
workflow_run_ok "${TEST_NAME}" cylc play --no-detach "${WORKFLOW_NAME}" |
| 34 |
|
| 35 |
# Restart with removed tasks should not cause an error. |
| 36 |
# It should shut down cleanly after orphaned task a and incomplete failed task |
| 37 |
# b are polled (even though b has been removed from the graph) and a finishes |
| 38 |
# (after checking the poll results). |
| 39 |
TEST_NAME="${TEST_NAME_BASE}-restart" |
| 40 |
workflow_run_ok "${TEST_NAME}" cylc play --set="INCL_B_C=False" --no-detach "${WORKFLOW_NAME}" |
| 41 |
|
| 42 |
grep_workflow_log_ok "grep-3" "\[1/a/01:running\] (polled)started" |
| 43 |
grep_workflow_log_ok "grep-4" "\[1/b/01:failed\] (polled)failed" |
| 44 |
|
| 45 |
# Failed (but not incomplete) task c should not have been polled. |
| 46 |
grep_fail "\[1/c/01:failed\] (polled)failed" "${WORKFLOW_RUN_DIR}/log/scheduler/log" |
| 47 |
|
| 48 |
purge |