Set the number of retries
To rerun your workflow when an exception is raised, set theretries
parameter to an integer.
Wait between retries
To add a wait between retries, pass a value to theretry_delay_seconds
parameter.
Retry parts of a workflow
You can configure retries for individual tasks in a workflow to limit the scope of a retry.Retry with configurable delay
A task’s retry delays can also be defined as a list of integers for different delays between retries.exponential_backoff
utility to generate a list of retry delays that correspond to an exponential backoff retry strategy.
Retry with a custom condition
Whether or not a task should be retried can be determined dynamically by passing a callable to theretry_condition_fn
parameter.
retry_condition_fn
returns True
, the task will be retried. Otherwise, the task will exit with an exception.
Add jitter to retry delays
To add a random amount of time to retry delays, pass a value to theretry_jitter_factor
parameter.
Configure task retry behavior globally
You can set the default retries and retry delays for all tasks via Prefect’s settings. The default values can be overridden on a per-task basis via theretries
and retry_delay_seconds
parameters.