Debian Codegraph @

tests/functional/hold-release/05-release.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 release 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 hold --after=0 ${CYLC_WORKFLOW_ID}
37 cylc__job__poll_grep_workflow_log 'Command "set_hold_point" actioned'
38 cylc release "${CYLC_WORKFLOW_ID}//1/*FF" # inexact fam
39 cylc release "${CYLC_WORKFLOW_ID}//1/TOAST" # exact fam
40 cylc release "${CYLC_WORKFLOW_ID}//1/cat*" # inexact tasks
41 cylc release "${CYLC_WORKFLOW_ID}//1/dog1" # exact tasks
42 cylc release "${CYLC_WORKFLOW_ID}//1/stop" # exact tasks
43
44 # TODO: finished tasks are not removed if held: should this be the case?
45 # (is this related to killed tasks being held to prevent retries?)
46 cylc release "${CYLC_WORKFLOW_ID}//1/spawner"
47 cylc release "${CYLC_WORKFLOW_ID}//1/holdrelease"
48
49 """
50 [[STUFF]]
51 [[TOAST]]
52 [[STOP]]
53 [[CATS, DOGS]]
54 [[cat1, cat2]]
55 inherit = CATS
56 [[dog1, dog2]]
57 inherit = DOGS
58 [[foo, bar]]
59 inherit = STUFF
60 script = true
61 [[cheese, jam]]
62 inherit = TOAST
63 script = true
64 [[stop]]
65 inherit = STOP
66 script = """
67 cylc__job__poll_grep_workflow_log -E \
68 '1/dog1/01:succeeded.* completed'
69 cylc stop "${CYLC_WORKFLOW_ID}"
70 """
71 __FLOW_CONFIG__
72
73 run_ok "${TEST_NAME_BASE}-val" cylc validate "${WORKFLOW_NAME}"
74
75 workflow_run_ok "${TEST_NAME_BASE}-run" \
76 cylc play --debug --no-detach --abort-if-any-task-fails "${WORKFLOW_NAME}"
77
78 # Should shut down with all non-released tasks in the held state, and dog1.1
79 # finished and gone from the task pool.
80
81 sqlite3 "${WORKFLOW_RUN_DIR}/log/db" \
82 'SELECT cycle, name, status, is_held FROM task_pool' > task-pool.out
83 cmp_ok task-pool.out <<__OUT__
84 1|dog2|waiting|1
85 __OUT__
86
87 purge