Retry from a previous task

Hi,

How can I do the following? i.e if task2 fails retry starting from task1

P1D = “”"
task3[-P1D] => task1 => task2? => task3
task2:fail? => task1
“”"
any ideas to achieve this would be appreciated.

Thanks

You can trigger a new flow to “rewind” the workflow to task1.

In the following example, task2 will fail and rewind the workflow twice, before succeeding and carrying on with task3:

[scheduling]
    [[graph]]
        R1 = """
            task1 => task2? => task3
            task2:fail? => rewinder
        """
[runtime]
    [[root]]
        pre-script = sleep 2
    [[task1]]
    [[task2]]
        script = """
            if (( CYLC_TASK_SUBMIT_NUMBER < 3 )); then
                false
            fi
        """
    [[rewinder]]
        script = """
           cylc trigger --flow=new ${CYLC_WORKFLOW_ID}//1/task1
        """
    [[task3]]

Result, after running it:

$ cylc log pra | grep -E '(succeeded|failed)'
INFO - [1/task1 running job:01 flows:1] => succeeded
INFO - [1/task2 running job:01 flows:1] => failed
INFO - [1/rewinder running job:01 flows:1] => succeeded
INFO - [1/task1 running job:02 flows:2] => succeeded
INFO - [1/task2 running job:02 flows:2] => failed
INFO - [1/rewinder running job:02 flows:2] => succeeded
INFO - [1/task1 running job:03 flows:3] => succeeded
INFO - [1/task2 running job:03 flows:3] => succeeded
INFO - [1/task3 running job:01 flows:3] => succeeded
2 Likes

Thanks, Oliver. Much appreciated.