# Check that a specified flow can be stopped without affecting the main flow.
# Here baz triggers a new flow then waits for the second baz to finish.
# Meanwhile the second bar stops its own flow. So order events should be:
# 1.  foo => bar => baz (flow a)
# 2.  foo => bar (flow b)
# 3.  qux (flow a)
[scheduler]
    allow implicit tasks = True
[scheduling]
    [[graph]]
        R1 = "foo => bar => baz => qux"
[runtime]
    [[bar]]
         script = """
if (( CYLC_TASK_SUBMIT_NUMBER == 2 )); then
   cylc stop --flow=1 ${CYLC_WORKFLOW_ID}
   cylc__job__poll_grep_workflow_log 'Command "stop" actioned'
fi
         """
    [[baz]]
         script = """
if (( CYLC_TASK_SUBMIT_NUMBER == 1 )); then
   cylc trigger --flow=new --meta=other "${CYLC_WORKFLOW_ID}//1/foo"
   cylc__job__poll_grep_workflow_log -E "1/bar/02\(flows=2\):running.* => succeeded"
fi
         """
