Re-run scheduled task on failure

I have some tasks that fail every now and again due to connection errors with SQL. This is nothing to do with EasyMorph (my client just has a flaky infrastructure). What I would like to do is re-run a task if it fails (for x amount of times), for example, if a task fails then re-run it until it fails 3 times (at which point the task show show as failing as normal).

At the moment, I can only see 2 ways of handling this:

  1. Before each Database query, have a ‘Repeat’ action that calls a Module ‘X’. (that runs until the result is empty, doesn’t return the result and and fails after 3 iterations). Module ‘X’ is a ‘Call another module/project’ which call Module ‘Y’ (which is set to capture errors and continue). Module ‘Y’ has a 30 seconds wait followed by a simple ‘Import from Database’ which connects to SQL.

So it does the following:
Waits 30 seconds and the connects to SQL, it that fails it would return error rows in Module ‘X’. The ‘Repeat’ action then says that the table isn’t empty and so iterates it (up to 3 times). If there isn’t an error then nothing is returned and the table is empty so it isn’t iterated and continues through the Project.

This isn’t ideal as I would have to put this process into every Project/Task for every ‘Import from database’ (which I have loads).

  1. Have a ‘Base’ Tasks that does the same as above (but for each Database connection in the Task I wish to run) and then in the ‘Base’ Task, have an ‘EasyMorph Server command’ to kick off the Task I wish to run.

Is there an easier way of re-running failed tasks automatically?


Hi Mat,

There is no option for re-running tasks automatically. Some Community members already requested such an option.

Just a few ideas:

If your tables are simple, you can have a universal re-usable module for querying a database table which name and connector are specified using parameters. In this case, you call a module, pass it a connector name and a table name, and the module returns the table and does re-tries if necessary.

Using the “Repeat” action looks right here. Alternatively, you can just call Module Y three times (once per each retry) instead of using “Repeat”. Between the retries, use the “Skip” action to skip further retries if a call was successful.