#!jinja2
{%- set TEST_DIR = environ['TEST_DIR'] %}
[cylc]
    UTC mode = True
    [[events]]
        timeout handler = shutdown_this_suite_hook
        timeout = PT3M
[scheduling]
    initial cycle time = 20130923T00
    final cycle time   = 20130923T00
    [[dependencies]]
        [[[R1]]]
            graph = """
                send_a_broadcast_task => shutdown
                shutdown => output_states
                output_states => broadcast_task
                broadcast_task => finish
            """
[runtime]
    [[root]]
        [[[events]]]
            failed handler = shutdown_this_suite_hook
    [[send_a_broadcast_task]]
        description = "Broadcast setup task"
        script = """
            cylc broadcast -n broadcast_task -t $CYLC_TASK_CYCLE_POINT -s "[environment]MY_VALUE='something'" $CYLC_SUITE_REG_NAME
            cylc broadcast -d $CYLC_SUITE_REG_NAME
        """
    [[broadcast_task]]
        description = "Broadcast-recipient task (runs after restart)"
        script = """
            if [[ "$MY_VALUE" != "something" ]]; then
                echo "[FAIL] MY_VALUE ($MY_VALUE) not set correctly by broadcast" >&2
                exit 1
            fi
            echo "[PASS] MY_VALUE=$MY_VALUE"
        """
        [[[environment]]]
            MY_VALUE=nothing
{% include 'suite-runtime-restart.rc' %}
