version: '2.0'
name: examples.mistral-handle-retry
description: >
    Sample workflow that demonstrates how to handle rollback and retry on error. 
    In this example, the workflow will error and then continue to retry until the file 
    /tmp/done exists. A parallel task will wait for some time before creating the
    file. When completed, /tmp/done will be deleted.

workflows:

    main:
        type: direct
        tasks:
            test-error-undo-retry:
                workflow: work
                policies:
                    retry:
                        count: 10
                        delay: 2
                on-complete:
                    - delete-file
            create-file:
                action: core.local
                input:
                    cmd: "touch /tmp/done"
                policies:
                    wait-before: 10
                on-complete:
                    - delete-file
            delete-file:
                join: all
                action: core.local
                input:
                    cmd: "rm -f /tmp/done"

    work:
        type: direct
        tasks:
            do:
                action: core.local
                input:
                    cmd: "if [ ! -e \"/tmp/done\" ]; then exit 1; fi"
                on-error:
                    - undo
            undo:
                action: core.local
                input:
                    cmd: "echo \"Define rollback tasks here.\""
                on-success:
                    - fail

version: '2.0'
name: examples.mistral-handle-retry
description: >
    Sample workflow that demonstrates how to handle rollback and retry on error. 
    In this example, the workflow will error and then continue to retry until the file 
    /tmp/done exists. A parallel task will wait for some time before creating the
    file. When completed, /tmp/done will be deleted.

workflows:

    main:
        type: direct
        tasks:
            test-error-undo-retry:
                workflow: work
                policies:
                    retry:
                        count: 10
                        delay: 2
                on-success:
                    - delete-file
            create-file:
                action: core.local
                input:
                    cmd: "touch /tmp/done"
                policies:
                    wait-before: 10
            delete-file:
                action: core.local
                input:
                    cmd: "rm -f /tmp/done"

    work:
        type: direct
        tasks:
            do:
                action: core.local
                input:
                    cmd: "if [ ! -e \"/tmp/done\" ]; then exit 1; fi"
                on-error:
                    - undo
            undo:
                action: core.local
                input:
                    cmd: "echo \"Define rollback tasks here.\""
                on-success:
                    - fail

Fix mistral workflow example to handle retry
Fix mistral workflow example to handle retry

Move the delete file task to run on success of the test retry task.
