| 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 |
. "$(dirname "$0")/test_header" |
| 19 |
set_test_number 4 |
| 20 |
|
| 21 |
BASE_GLOBAL_CONFIG=" |
| 22 |
[scheduler] |
| 23 |
[[main loop]] |
| 24 |
plugins = health check, auto restart |
| 25 |
[[[auto restart]]] |
| 26 |
interval = PT5S |
| 27 |
[[events]] |
| 28 |
abort on inactivity timeout = True |
| 29 |
abort on stall timeout = True |
| 30 |
inactivity timeout = PT2M |
| 31 |
stall timeout = PT2M |
| 32 |
" |
| 33 |
#------------------------------------------------------------------------------- |
| 34 |
# test the force shutdown option (auto stop, no restart) in condemned hosts |
| 35 |
init_workflow "${TEST_NAME_BASE}" <<< ' |
| 36 |
[scheduler] |
| 37 |
allow implicit tasks = True |
| 38 |
[scheduling] |
| 39 |
[[graph]] |
| 40 |
R1 = foo |
| 41 |
' |
| 42 |
|
| 43 |
create_test_global_config '' " |
| 44 |
${BASE_GLOBAL_CONFIG} |
| 45 |
[scheduler] |
| 46 |
[[run hosts]] |
| 47 |
available = localhost |
| 48 |
" |
| 49 |
|
| 50 |
cylc play "${WORKFLOW_NAME}" --pause |
| 51 |
poll_workflow_running |
| 52 |
|
| 53 |
create_test_global_config '' " |
| 54 |
${BASE_GLOBAL_CONFIG} |
| 55 |
[scheduler] |
| 56 |
[[run hosts]] |
| 57 |
available = localhost |
| 58 |
condemned = $(localhost_fqdn)! |
| 59 |
" |
| 60 |
|
| 61 |
FILE=$(cylc cat-log "${WORKFLOW_NAME}" -m p |xargs readlink -f) |
| 62 |
log_scan "${TEST_NAME_BASE}-no-auto-restart" "${FILE}" 20 1 \ |
| 63 |
'The Cylc workflow host will soon become un-available' \ |
| 64 |
'This workflow will be shutdown as the workflow host is' \ |
| 65 |
'When another workflow host becomes available the workflow can' \ |
| 66 |
'Workflow shutting down - REQUEST(NOW)' |
| 67 |
|
| 68 |
cylc stop --kill --max-polls=10 --interval=2 "${WORKFLOW_NAME}" 2>'/dev/null' |
| 69 |
purge |
| 70 |
exit |