Debian Codegraph @

tests/functional/intelligent-host-selection/03-polling.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 intelligent host selection for job polling.
19 #
20 # Set the peridic clearance of unreachable hosts by
21 # `[scheduler][main loop][reset bad hosts]interval = PT1S` so that between
22 # Submission of a job and execution polling the list of bad hosts will have
23 # cleared. Having cleared bad hosts we can then test that polling goes through
24 # the host selection process.
25
26 export REQUIRE_PLATFORM='loc:remote fs:indep'
27
28 . "$(dirname "$0")/test_header"
29
30 #-------------------------------------------------------------------------------
31 set_test_number 4
32
33 # Uses a fake background job runner to get around the single host restriction.
34
35 create_test_global_config "" "
36 [scheduler]
37 [[main loop]]
38 [[[reset bad hosts]]]
39 interval = PT1S
40
41 [platforms]
42 [[goodhostplatform]]
43 hosts = ${CYLC_TEST_HOST}
44 install target = ${CYLC_TEST_INSTALL_TARGET}
45 retrieve job logs = True
46 communication method = poll
47 execution polling intervals = 10*PT3S
48 submission polling intervals = PT0S, 5*PT2S
49
50 [[mixedhostplatform]]
51 job runner = my_background
52 hosts = unreachable_host, ${CYLC_TEST_HOST}
53 install target = ${CYLC_TEST_INSTALL_TARGET}
54 retrieve job logs = True
55 communication method = poll
56 execution polling intervals = 10*PT3S
57 submission polling intervals = PT0S, 5*PT2S
58 [[[selection]]]
59 method = 'definition order'
60 "
61 #-------------------------------------------------------------------------------
62 install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
63
64 # Install the fake background job runner.
65 cp -r "${TEST_SOURCE_DIR}/lib" "${WORKFLOW_RUN_DIR}"
66
67 run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"
68
69 workflow_run_ok "${TEST_NAME_BASE}-run" \
70 cylc play --debug --no-detach \
71 "${WORKFLOW_NAME}"
72
73 LOGFILE="${WORKFLOW_RUN_DIR}/log/scheduler/log"
74
75 # Check that when a task fail badhosts associated with that task's platform
76 # are removed from the badhosts set.
77 named_grep_ok \
78 "job poll fails" \
79 "Could not connect to unreachable_host" \
80 "${LOGFILE}"
81
82 named_grep_ok "job poll retries & succeeds" \
83 "\[jobs-poll out\] \[TASK JOB SUMMARY\].*1/mixedhosttask/01" \
84 "${LOGFILE}"
85
86 purge
87 exit 0