Skip to main content

@retry

The @retry decorator specifies how many times the task(s) corresponding to a step should be retried before failing the flow.

For more information, see Dealing with Failures.

@retry(...)

[source]

from metaflow import retry

Specifies the number of times the task corresponding to a step needs to be retried.

This decorator is useful for handling transient errors, such as networking issues. If your task contains operations that can't be retried safely, e.g. database updates, it is advisable to annotate it with @retry(times=0).

This can be used in conjunction with the @catch decorator. The @catch decorator will execute a no-op task after all retries have been exhausted, ensuring that the flow execution can continue.

Parameters 

times: int, default: 3

Number of times to retry this task.

minutes_between_retries: int, default: 2

Number of minutes between retries.