Debian Codegraph @

tests/f/hold-release/08-hold.t

raw
1 #!/usr/bin/env bash
2 # THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
3 # Copyright (C) 2008-2019 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 task and family hold via exact and inexact name matches.
19 . "$(dirname "$0")/test_header"
20
21 set_test_number 3
22
23 init_workflow "${TEST_NAME_BASE}" <<'__FLOW_CONFIG__'
24 [scheduler]
25 allow implicit tasks = True
26 [[events]]
27 stall timeout = PT1M
28 abort on stall timeout = True
29 [scheduling]
30 [[graph]]
31 R1 = "spawner & holdrelease => STUFF & TOAST & CATS & DOGS & stop"
32 [runtime]
33 [[holdrelease]]
34 script = """
35 cylc__job__wait_cylc_message_started
36 cylc__job__poll_grep_workflow_log -E '1/foo.* added to the n=0 window'
37 cylc__job__poll_grep_workflow_log -E '1/bar.* added to the n=0 window'
38 cylc__job__poll_grep_workflow_log -E '1/cheese.* added to the n=0 window'
39 cylc__job__poll_grep_workflow_log -E '1/jam.* added to the n=0 window'
40 cylc__job__poll_grep_workflow_log -E '1/cat1.* added to the n=0 window'
41 cylc__job__poll_grep_workflow_log -E '1/cat2.* added to the n=0 window'
42 cylc__job__poll_grep_workflow_log -E '1/dog1.* added to the n=0 window'
43 cylc__job__poll_grep_workflow_log -E '1/dog2.* added to the n=0 window'
44 cylc hold "${CYLC_WORKFLOW_ID}//1/*FF" # inexact fam
45 cylc hold "${CYLC_WORKFLOW_ID}//1/TOAST" # exact fam
46 cylc hold "${CYLC_WORKFLOW_ID}//1/cat*" # inexact tasks
47 cylc hold "${CYLC_WORKFLOW_ID}//1/dog1" # exact tasks
48 """
49 [[STUFF]]
50 [[TOAST]]
51 [[STOP]]
52 [[CATS, DOGS]]
53 [[cat1, cat2]]
54 inherit = CATS
55 [[dog1, dog2]]
56 inherit = DOGS
57 [[foo, bar]]
58 inherit = STUFF
59 script = true
60 [[cheese, jam]]
61 inherit = TOAST
62 script = true
63 [[stop]]
64 inherit = STOP
65 script = """
66 sleep 5
67 cylc stop "${CYLC_WORKFLOW_ID}"
68 """
69 __FLOW_CONFIG__
70
71 run_ok "${TEST_NAME_BASE}-val" cylc validate "${WORKFLOW_NAME}"
72
73 workflow_run_ok "${TEST_NAME_BASE}-run" \
74 cylc play --debug --no-detach --abort-if-any-task-fails "${WORKFLOW_NAME}"
75
76 # Should shut down with all the held tasks in the held state, and 2/dog
77 # finished and gone from the task pool.
78
79 sqlite3 "${WORKFLOW_RUN_DIR}/log/db" \
80 'SELECT cycle, name, status, is_held FROM task_pool' | sort > task-pool.out
81 cmp_ok task-pool.out <<__OUT__
82 1|bar|waiting|1
83 1|cat1|waiting|1
84 1|cat2|waiting|1
85 1|cheese|waiting|1
86 1|dog1|waiting|1
87 1|foo|waiting|1
88 1|jam|waiting|1
89 __OUT__
90
91 purge