[meta]
    title = queue size reload test
    description = """change the size of a queue via a reload."""

[cylc]
   [[reference test]]
       required run mode = live
       live mode suite timeout=PT1M

[scheduling]
    [[ queues ]]
        [[[ q_fam ]]]
            limit = 5 # marker
            members = reloader, FAM
    [[dependencies]]
        graph = """reloader:start => FAM
                   reloader => monitor"""
[runtime]
    [[FAM]]
        script = sleep 10
    [[a,b,c,d,e,f,g,h,i,j,k,l]]
        inherit = FAM
    [[reloader]]
        script = """
# change the limit on number of members of q_fam:
perl -pi -e 's/(limit = )5( # marker)/\1 3 \2/' $CYLC_SUITE_DEF_PATH/suite.rc
# reload
cylc reload -f $CYLC_SUITE_NAME
sleep 5
"""
    [[monitor]]
        script = """
        sleep 5
        while true; do
            TASKS=$(cylc suite-state $CYLC_SUITE_NAME -S running | wc -l)
            if ((TASKS > 4)); then
                break
            fi
            sleep 1
            SUCCEEDED=$(cylc suite-state $CYLC_SUITE_NAME -S succeeded | wc -l)
            if ((SUCCEEDED==13)); then
                break
            fi
            sleep 1
        done
        if ((TASKS > 3)); then
            false
        else
            true
        fi
"""
