#!jinja2
{%- set TEST_DIR = environ['TEST_DIR'] %}

# TODO SoD: added new "remove" tasks to get rid of submit-failed one and allow
# shutdown, in lieu of suicidge triggers.  What's the best way to handle this?
[scheduler]
    UTC mode = True
    [[events]]
        abort on stall timeout = True
        stall timeout = PT3M

[scheduling]
    initial cycle point = 20130923T00
    final cycle point   = 20130923T00
    [[graph]]
        R1 = """
            submit_failed_task:submit-fail? => shutdown
            submit_failed_task:submitted? => error

            shutdown => output_states
            output_states => remove => finish
        """

[runtime]
    [[submit_failed_task]]
        script = """
            exit 1  # Should not submit, so this shouldn't run!
        """
        platform = {{ environ['CYLC_TEST_PLATFORM'] }}
        [[[meta]]]
            description = "Submit-failed task (runs before restart)"
    [[remove]]
        script = """
            cylc remove "${CYLC_WORKFLOW_ID}//${CYLC_TASK_CYCLE_POINT}/submit_failed_task"
        """
    [[error]]
        script = """
            cylc message -- "ERROR:this-task-should-have-submit-failed"
            exit 1
        """

{% include 'flow-runtime-restart.cylc' %}
