#!jinja2
{%- set TEST_DIR = environ['TEST_DIR'] %}
[cylc]
    UTC mode = True
    abort if any task fails = True
    [[events]]
        abort on timeout = True
        timeout = PT1M
[scheduling]
    initial cycle point = 20130923T00
    final cycle point   = 20130923T00
    [[dependencies]]
        [[[R1]]]
            graph = """
                send_a_broadcast_task => shutdown
                shutdown => output_states
                output_states => broadcast_task
                broadcast_task => finish
            """
[runtime]
    [[send_a_broadcast_task]]
        script = """
            cylc broadcast -n broadcast_task -p $CYLC_TASK_CYCLE_POINT -s "[environment]MY_VALUE='something'" $CYLC_SUITE_NAME
            cylc broadcast -d $CYLC_SUITE_NAME
        """
        [[[meta]]]
            description = "Broadcast setup task"
    [[broadcast_task]]
        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"
        """
        [[[meta]]]
            description = "Broadcast-recipient task (runs after restart)"
        [[[environment]]]
            MY_VALUE=nothing
{% include 'suite-runtime-restart.rc' %}
