Debian Codegraph @

tests/f/reload/03-queues/flow.cylc

raw
1 # Change queue limit by reload and check number of running tasks to confirm
2 # that the new limit is being applied. This test is potentially flaky because
3 # it checks task status using the "cylc workflow-state" DB command, and DB task
4 # states (like the datastore too) only get updated once per main loop.
5
6 [scheduling]
7 [[ queues ]]
8 [[[ q1 ]]]
9 limit = 5 # marker
10 members = reloader, FAM
11 [[graph]]
12 R1 = """reloader:start => FAM
13 reloader => monitor"""
14 [runtime]
15 [[FAM]]
16 script = sleep 10
17 [[a,b,c,d,e,f,g,h,i,j,k,l]]
18 inherit = FAM
19 [[reloader]]
20 script = """
21 # change the limit from 5 to 3:
22 perl -pi -e 's/(limit = )5( # marker)/\1 3 \2/' $CYLC_WORKFLOW_RUN_DIR/flow.cylc
23 # reload:
24 cylc reload "${CYLC_WORKFLOW_ID}"
25 cylc__job__poll_grep_workflow_log 'Reload completed'
26 """
27 [[monitor]]
28 script = """
29 cylc__job__wait_cylc_message_started
30 while true; do
31 RUNNING=$(cylc dump -l -t "${CYLC_WORKFLOW_ID}" | grep running | wc -l)
32 # Should be max of: monitor plus 3 members of q1
33 echo "RUNNING $RUNNING"
34 if ((RUNNING > 4)); then
35 break
36 fi
37 sleep 1
38 SUCCEEDED=$(cylc workflow-state "${CYLC_WORKFLOW_ID}//*/*:succeeded" --max-polls=1 | wc -l)
39 echo "SUCCEEDED $SUCCEEDED"
40 if ((SUCCEEDED==13)); then
41 break
42 fi
43 sleep 1
44 done
45 if ((RUNNING > 4)); then
46 false
47 else
48 true
49 fi
50 """