| 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 restarting a simple workflow with a task still running (orphaned) |
| 19 |
. "$(dirname "$0")/test_header" |
| 20 |
set_test_number 5 |
| 21 |
init_workflow "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__' |
| 22 |
[scheduler] |
| 23 |
[[events]] |
| 24 |
abort on stall timeout = True |
| 25 |
stall timeout = PT0S |
| 26 |
abort on inactivity timeout = True |
| 27 |
inactivity timeout = PT3M |
| 28 |
[scheduling] |
| 29 |
[[graph]] |
| 30 |
R1 = t1 |
| 31 |
[runtime] |
| 32 |
[[t1]] |
| 33 |
script = """ |
| 34 |
cylc__job__wait_cylc_message_started |
| 35 |
cylc stop --now "${CYLC_WORKFLOW_ID}" |
| 36 |
cylc__job__poll_grep_workflow_log -F 'Run: (re)start number=1' |
| 37 |
# Should be good to send succeeded message at this point |
| 38 |
""" |
| 39 |
__FLOW_CONFIG__ |
| 40 |
#------------------------------------------------------------------------------- |
| 41 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" |
| 42 |
workflow_run_ok "${TEST_NAME_BASE}-run" \ |
| 43 |
cylc play --debug --no-detach "${WORKFLOW_NAME}" |
| 44 |
sqlite3 "${WORKFLOW_RUN_DIR}/log/db" 'SELECT cycle, name, status FROM task_pool' >'sqlite3.out' |
| 45 |
cmp_ok 'sqlite3.out' <<'__DB_DUMP__' |
| 46 |
1|t1|running |
| 47 |
__DB_DUMP__ |
| 48 |
workflow_run_ok "${TEST_NAME_BASE}-restart" \ |
| 49 |
cylc play --debug --no-detach "${WORKFLOW_NAME}" |
| 50 |
sqlite3 "${WORKFLOW_RUN_DIR}/log/db" 'SELECT * FROM task_pool' >'sqlite3.out' |
| 51 |
cmp_ok 'sqlite3.out' <'/dev/null' |
| 52 |
#------------------------------------------------------------------------------- |
| 53 |
purge |
| 54 |
exit |