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

[scheduling]
    [[ queues ]]
        [[[ q_fam ]]]
            limit = 5 # marker
            members = reloader, FAM
    [[graph]]
        R1 = """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}"
cylc__job__poll_grep_suite_log 'Reload completed'
"""
    [[monitor]]
        script = """
        wait
        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
"""
