[meta]
    title = "automated failure recovery example"

    description = """
Model task failure triggers diagnosis and recovery tasks, which
otherwise take themselves out of the suite if model succeeds.
Model post processing triggers off model or recovery tasks."""

[cylc]
    UTC mode = True
    [[reference test]]
        live mode suite timeout = PT50S
        expected task failures = model.20110101T1200Z
        
[scheduling]
    initial cycle point = 20110101T00
    final cycle point = 20110101T12

    [[dependencies]]
        [[[T00,T12]]]
            graph = """
                       pre:finish => model  # finish trigger
                       model:fail => diagnose => recover # fail trigger
                       model => !diagnose & !recover  # explicit success trigger
                       model:succeed | recover => post  # conditional and explicit success 
                       post => !model  # removes failed model to allow suite to auto finish
                    """
[runtime]
    [[root]]
        script = "true" # fast
    [[model]]
        description = "A task that succeeds at O UTC and fails at 12 UTC"
        script = """
echo Hello from $CYLC_TASK_ID
#sleep 10
if [[ $(cylc util cycletime --print-hour) == 12 ]]; then 
    echo "FAILING NOW!"
    false
else
    echo "Succeeded"
    true
fi"""
