#!jinja2
[meta]
    title=Task Event Handler Retry
    URL = http://my-suites.com/${CYLC_SUITE_NAME}.html

[cylc]
    [[reference test]]
        live mode suite timeout=PT1M

[scheduling]
    [[dependencies]]
        graph="t1 => t2"

[runtime]
    [[t1]]
        script=true
        [[[meta]]]
            URL = http://my-suites.com/${CYLC_SUITE_NAME}/${CYLC_TASK_NAME}.html
{% if HOST is defined %}
        [[[remote]]]
            host = {{HOST}}
{% endif %}
{% if GLOBALCFG is not defined %}
        [[[events]]]
            handlers = hello-event-handler %(name)s %(event)s %(suite_url)s %(task_url)s %(message)s %(point)s %(submit_num)s %(id)s
            handler events=succeeded, failed
            handler retry delays=PT0S, 2*PT1S
{% endif %}{# not GLOBALCFG is not defined #}
    [[t2]]
        script="""
LOG="${CYLC_SUITE_LOG_DIR}/../job/1/t1/NN/job-activity.log"
STR="[(('event-handler-00', 'succeeded'), 1) ret_code] 0"
timeout 30 bash -c "while ! grep -q -F \"${STR}\" '${LOG}'; do sleep 1; done"
"""
