Skip to content
Advertisement

Dask: Continue with others task if one fails

I have a simple (but large) task Graph in Dask. This is a code example

JavaScript

Here SomeIterable is a list of dict, where each are arguments to my_function. In each iteration b depends on a, so if the task that produces a fails, b can’t be computed. But, each element of results are independent, so I expect if one fails, the other can continue running. This does not happen in practice, if an element of results fails, then the execution of the script ends.

EDIT:

This also happen when using the submit (or map) method of the client class dask.distributed.Client, for example

JavaScript

In the code above if one task fails when I try to gather a result, all code fails as in the docs

Advertisement

Answer

An easy way out of this is to wrap your functions in try/except, so something like this:

JavaScript

However, depending on your case, you might want to use the client.submit API, since it will give you some further flexibility, e.g. specifying some conditional retries.

Advertisement