Debian Codegraph @

tests/functional/restart/43-auto-restart-force-override-normal.t

raw
1 #!/usr/bin/env 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 # Check that "Force Mode" can override a scheduler "Normal Mode" restart.
19 export REQUIRE_PLATFORM='loc:remote fs:shared runner:background'
20 . "$(dirname "$0")/test_header"
21 # shellcheck disable=SC2153
22 export CYLC_TEST_HOST_2="${CYLC_TEST_HOST}"
23 export CYLC_TEST_HOST_1="${HOSTNAME}"
24 #-------------------------------------------------------------------------------
25 BASE_GLOBAL_CONFIG='
26 [scheduler]
27 [[main loop]]
28 plugins = health check, auto restart
29 [[[auto restart]]]
30 interval = PT5S
31 [[events]]
32 abort on inactivity timeout = True
33 abort on stall timeout = True
34 inactivity timeout = PT2M
35 stall timeout = PT2M
36 '
37
38 init_workflow "${TEST_NAME_BASE}" <<< '
39 [scheduler]
40 [[events]]
41 [scheduling]
42 initial cycle point = 2000
43 [[graph]]
44 P1Y = foo[-P1Y] => foo
45 [runtime]
46 [[foo]]
47 '
48
49 create_test_global_config '' "
50 ${BASE_GLOBAL_CONFIG}
51 [scheduler]
52 [[run hosts]]
53 available = ${CYLC_TEST_HOST_1}, ${CYLC_TEST_HOST_2}
54 # ensure the workflow can start if a host is condemned
55 # in force mode see #6623
56 condemned = ${CYLC_TEST_HOST_2}!
57 "
58
59 set_test_number 8
60 #-------------------------------------------------------------------------------
61 run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"
62
63 # run workflow
64 cylc play "${WORKFLOW_NAME}" --abort-if-any-task-fails
65 poll_workflow_running
66 sleep 1
67 FILE=$(cylc cat-log "${WORKFLOW_NAME}" -m p |xargs readlink -f)
68
69 # condemn the host, the workflow will schedule restart in PT60S
70 create_test_global_config '' "
71 ${BASE_GLOBAL_CONFIG}
72 [scheduler]
73 auto restart delay = -PT60S # results in +PT60S delay
74 [[run hosts]]
75 available = ${CYLC_TEST_HOST_1}, ${CYLC_TEST_HOST_2}
76 condemned = ${CYLC_TEST_HOST_1}
77 "
78 log_scan "${TEST_NAME_BASE}-stop" "${FILE}" 40 1 \
79 'The Cylc workflow host will soon become un-available' \
80 'Workflow will restart in 60s'
81
82 # condemn the host in "Force Mode", this should cancel the scheduled restart
83 create_test_global_config '' "
84 ${BASE_GLOBAL_CONFIG}
85 [scheduler]
86 [[run hosts]]
87 condemned = ${CYLC_TEST_HOST_1}!
88 "
89 log_scan "${TEST_NAME_BASE}-stop" "${FILE}" 40 1 \
90 'This workflow will be shutdown as the workflow host is' \
91 'When another workflow host becomes available the workflow can' \
92 'Scheduled automatic restart canceled' \
93 'Workflow shutting down - REQUEST(NOW)' \
94 'DONE'
95
96 cylc stop --now --now--max-polls=20 --interval=2 "${WORKFLOW_NAME}" 2>'/dev/null'
97 purge
98
99 exit