Omar Khudeira
05/20/2024, 6:53 PMMarvin
05/20/2024, 6:53 PMretry_delay_seconds
to define a list of delays for custom retry behavior and retry_condition_fn
to specify a custom callable that returns a boolean to determine whether to retry a task.
For instance, to define successive retry intervals, you might annotate a task like this:
python
from prefect import task
@task(retries=3, retry_delay_seconds=[1, 10, 100])
def some_task_with_manual_backoff_retries():
pass
If you wish to add jitter to your retries to avoid thundering herd problems, the retry_jitter_factor
option allows for variance in the base delay:
python
from prefect import task
from prefect.tasks import exponential_backoff
@task(
retries=3,
retry_delay_seconds=exponential_backoff(backoff_factor=10),
retry_jitter_factor=1,
)
def some_task_with_exponential_backoff_retries():
pass
However, it's important to note that these features are for task retries, and the documentation I found does not show similar configurations directly available for flows. For more tailored retries at the flow level, one would likely need to handle retry logic manually. You can review the specifics of task retry configuration in the Prefect documentation.Bianca Hoch
05/20/2024, 7:20 PMOmar Khudeira
05/20/2024, 7:22 PMBianca Hoch
05/20/2024, 7:29 PMOmar Khudeira
05/20/2024, 7:29 PM