Debian Codegraph @

tests/functional/run_modes/04-simulation-runtime.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 # Test that we can broadcast an alteration to simulation mode.
19
20 . "$(dirname "$0")/test_header"
21 skip_macos_gh_actions
22 set_test_number 7
23
24 install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
25 run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"
26 workflow_run_ok "${TEST_NAME_BASE}-start" \
27 cylc play "${WORKFLOW_NAME}" --mode=simulation --pause
28 SCHD_LOG="${WORKFLOW_RUN_DIR}/log/scheduler/log"
29
30 # This broadcast will ensure that second_task will not finish
31 # in time for the workflow timeout, unless the broadcast
32 # cancelletion works correctly:
33 run_ok "second-task-broadcast-too-long" \
34 cylc broadcast "${WORKFLOW_NAME}" \
35 -n second_task \
36 -s 'execution time limit = P1D'
37
38 poll_grep 'Broadcast set:' "${SCHD_LOG}"
39
40 # Test cancelling broadcast changes the task config back.
41 run_ok "cancel-second-task-broadcast" \
42 cylc broadcast "${WORKFLOW_NAME}" \
43 -n second_task\
44 --clear
45
46 poll_grep 'Broadcast cancelled:' "${SCHD_LOG}"
47
48 # If we speed up the simulated first_task task we
49 # can make it finish before workflow timeout
50 # (neither change will do this on its own):
51 run_ok "first-task-speed-up-broadcast" \
52 cylc broadcast "${WORKFLOW_NAME}" \
53 -n first_task \
54 -s '[simulation]speedup factor = 60' \
55 -s 'execution time limit = PT60S'
56
57 workflow_run_ok "${TEST_NAME_BASE}-unpause" \
58 cylc play "${WORKFLOW_NAME}"
59
60 # Wait for the workflow to finish (it wasn't run in no-detach mode):
61 poll_workflow_stopped
62
63 # If we hadn't changed the speedup factor using broadcast
64 # The workflow timeout would have been hit:
65 grep_fail "WARNING - Orphaned tasks" "${SCHD_LOG}"
66
67 purge