Debian Codegraph @

tests/f/intelligent-host-selection/04-kill.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 job kill. Set the auto clearance of badhosts to be << small time
19 # so that kill will need to retry, despite 'unreachable_host' being idetified
20 # as unreachable by job submission.
21 export REQUIRE_PLATFORM='loc:remote fs:indep comms:tcp'
22 . "$(dirname "$0")/test_header"
23
24 #-------------------------------------------------------------------------------
25 set_test_number 4
26
27 # Uses a fake background job runner to get around the single host restriction.
28
29 create_test_global_config "" "
30 [scheduler]
31 [[main loop]]
32 [[[reset bad hosts]]]
33 interval = PT5S
34
35 [platforms]
36 [[goodhostplatform]]
37 hosts = ${CYLC_TEST_HOST}
38 install target = ${CYLC_TEST_INSTALL_TARGET}
39
40 [[mixedhostplatform]]
41 job runner = my_background
42 hosts = unreachable_host, ${CYLC_TEST_HOST}
43 install target = ${CYLC_TEST_INSTALL_TARGET}
44 [[[selection]]]
45 method = 'definition order'
46 "
47 #-------------------------------------------------------------------------------
48
49 install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
50
51 # Install the fake background job runner.
52 cp -r "${TEST_SOURCE_DIR}/lib" "${WORKFLOW_RUN_DIR}"
53
54 run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"
55
56 workflow_run_ok "${TEST_NAME_BASE}-run" \
57 cylc play --debug --no-detach \
58 "${WORKFLOW_NAME}"
59
60 LOGFILE="${WORKFLOW_RUN_DIR}/log/scheduler/log"
61
62 # Check that when a task fail badhosts associated with that task's platform
63 # are removed from the badhosts set.
64 named_grep_ok "job kill fails" \
65 "Could not connect to unreachable_host" \
66 "${LOGFILE}"
67
68 named_grep_ok "job kill retries & succeeds" \
69 "\[jobs-kill out\] \[TASK JOB SUMMARY\].*1/mixedhosttask/01" \
70 "${LOGFILE}"
71
72
73 purge
74 exit 0