| 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 workflow with multi-cycle tasks and interdependencies. |
| 19 |
if [[ -z "${TEST_DIR:-}" ]]; then |
| 20 |
. "$(dirname "$0")/test_header" |
| 21 |
fi |
| 22 |
#------------------------------------------------------------------------------- |
| 23 |
set_test_number 6 |
| 24 |
#------------------------------------------------------------------------------- |
| 25 |
install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}" |
| 26 |
#------------------------------------------------------------------------------- |
| 27 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" |
| 28 |
if ! command -v 'sqlite3' > /dev/null; then |
| 29 |
skip 5 'sqlite3 not installed?' |
| 30 |
purge |
| 31 |
exit 0 |
| 32 |
fi |
| 33 |
workflow_run_ok "${TEST_NAME_BASE}-run" \ |
| 34 |
cylc play --debug --no-detach "${WORKFLOW_NAME}" |
| 35 |
workflow_run_ok "${TEST_NAME_BASE}-restart" \ |
| 36 |
cylc play --debug --no-detach "${WORKFLOW_NAME}" |
| 37 |
#------------------------------------------------------------------------------- |
| 38 |
# The waiting tasks below have two parents and are spawned by the earlier |
| 39 |
# intercycle dependencies. |
| 40 |
cmp_ok "${WORKFLOW_RUN_DIR}/pre-restart-db" <<'__DB_DUMP__' |
| 41 |
bar|20130923T0000Z|1|1|succeeded |
| 42 |
bar|20130923T1200Z|1|1|succeeded |
| 43 |
bar|20130924T0000Z|1|1|succeeded |
| 44 |
bar|20130924T1200Z|1|1|succeeded |
| 45 |
bar|20130925T0000Z|0||waiting |
| 46 |
bar|20130925T1200Z|0||waiting |
| 47 |
foo|20130923T0000Z|1|1|succeeded |
| 48 |
foo|20130923T1200Z|1|1|succeeded |
| 49 |
foo|20130924T0000Z|1|1|succeeded |
| 50 |
foo|20130924T1200Z|1|1|succeeded |
| 51 |
foo|20130925T0000Z|0||waiting |
| 52 |
__DB_DUMP__ |
| 53 |
contains_ok "${WORKFLOW_RUN_DIR}/post-restart-db" <<'__DB_DUMP__' |
| 54 |
bar|20130923T0000Z|1|1|succeeded |
| 55 |
bar|20130923T1200Z|1|1|succeeded |
| 56 |
bar|20130924T0000Z|1|1|succeeded |
| 57 |
bar|20130924T1200Z|1|1|succeeded |
| 58 |
foo|20130923T0000Z|1|1|succeeded |
| 59 |
foo|20130923T1200Z|1|1|succeeded |
| 60 |
foo|20130924T0000Z|1|1|succeeded |
| 61 |
foo|20130924T1200Z|1|1|succeeded |
| 62 |
shutdown|20130925T0000Z|1|1|succeeded |
| 63 |
__DB_DUMP__ |
| 64 |
"${TEST_SOURCE_DIR}/bin/ctb-select-task-states" "${WORKFLOW_RUN_DIR}" \ |
| 65 |
> "${TEST_DIR}/db" |
| 66 |
cmp_ok "${TEST_DIR}/db" <<'__DB_DUMP__' |
| 67 |
bar|20130923T0000Z|1|1|succeeded |
| 68 |
bar|20130923T1200Z|1|1|succeeded |
| 69 |
bar|20130924T0000Z|1|1|succeeded |
| 70 |
bar|20130924T1200Z|1|1|succeeded |
| 71 |
bar|20130925T0000Z|1|1|succeeded |
| 72 |
bar|20130925T1200Z|1|1|succeeded |
| 73 |
bar|20130926T0000Z|1|1|succeeded |
| 74 |
foo|20130923T0000Z|1|1|succeeded |
| 75 |
foo|20130923T1200Z|1|1|succeeded |
| 76 |
foo|20130924T0000Z|1|1|succeeded |
| 77 |
foo|20130924T1200Z|1|1|succeeded |
| 78 |
foo|20130925T0000Z|1|1|succeeded |
| 79 |
foo|20130925T1200Z|1|1|succeeded |
| 80 |
foo|20130926T0000Z|1|1|succeeded |
| 81 |
output_states|20130925T0000Z|1|1|succeeded |
| 82 |
shutdown|20130925T0000Z|1|1|succeeded |
| 83 |
__DB_DUMP__ |
| 84 |
#------------------------------------------------------------------------------- |
| 85 |
purge |
| 86 |
exit |