| 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 |
# Test restart remote init, file install and task messaging works for running tasks |
| 19 |
# The test works as follows: |
| 20 |
# - Starts workflow off with a remote starter task which will not complete |
| 21 |
# until restarted. It greps for updated file which will be remote installed on |
| 22 |
# restart. |
| 23 |
# - On start of this starter task, update the file that is included in |
| 24 |
# remote file install for starter task. |
| 25 |
# - Stop the workflow - this will leave starter task orphaned |
| 26 |
# - Restart, starter task should remote install, authentication keys will be |
| 27 |
# updated which is verified by checking task messaging works (checks for |
| 28 |
# "(received)succeeded" in the logs). |
| 29 |
|
| 30 |
export REQUIRE_PLATFORM='loc:remote fs:indep comms:?(tcp|ssh)' |
| 31 |
. "$(dirname "$0")/test_header" |
| 32 |
set_test_number 6 |
| 33 |
|
| 34 |
init_workflow "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__' |
| 35 |
[scheduler] |
| 36 |
install = changing-file |
| 37 |
[[events]] |
| 38 |
abort on inactivity timeout = True |
| 39 |
inactivity timeout = PT1M |
| 40 |
[scheduling] |
| 41 |
[[graph]] |
| 42 |
R1 = """ |
| 43 |
starter:start => file-changer => stopper |
| 44 |
""" |
| 45 |
[runtime] |
| 46 |
[[starter]] |
| 47 |
platform = ${CYLC_TEST_PLATFORM} |
| 48 |
script = """ |
| 49 |
while ! grep 'Restart Play' "${CYLC_WORKFLOW_RUN_DIR}/changing-file"; do |
| 50 |
sleep 1 |
| 51 |
done |
| 52 |
""" |
| 53 |
[[stopper]] |
| 54 |
script = cylc stop --now "${CYLC_WORKFLOW_ID}" |
| 55 |
[[file-changer]] |
| 56 |
script = echo Restart Play > ${CYLC_WORKFLOW_RUN_DIR}/changing-file |
| 57 |
__FLOW_CONFIG__ |
| 58 |
|
| 59 |
|
| 60 |
echo "First Play" > "${WORKFLOW_RUN_DIR}/changing-file" |
| 61 |
|
| 62 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" |
| 63 |
|
| 64 |
workflow_run_ok "${TEST_NAME_BASE}-start" \ |
| 65 |
cylc play --debug --no-detach "${WORKFLOW_NAME}" |
| 66 |
|
| 67 |
workflow_run_ok "${TEST_NAME_BASE}-restart" \ |
| 68 |
cylc play --debug --no-detach "${WORKFLOW_NAME}" |
| 69 |
LOG="${WORKFLOW_RUN_DIR}/log/scheduler/log" |
| 70 |
grep_ok "remote file install complete" "${LOG}" |
| 71 |
grep_ok "\[1/starter/01:running\] (received)succeeded" "${LOG}" |
| 72 |
ls "${WORKFLOW_RUN_DIR}/log/remote-install" > 'ls.out' |
| 73 |
cmp_ok ls.out <<__RLOGS__ |
| 74 |
01-start-${CYLC_TEST_INSTALL_TARGET}.log |
| 75 |
02-restart-${CYLC_TEST_INSTALL_TARGET}.log |
| 76 |
__RLOGS__ |
| 77 |
purge |
| 78 |
exit |