<@ULVA73B9P> Do prefect tasks have a default numbe...
# ask-marvin
d
@Marvin Do prefect tasks have a default number of retries? or is it 0?
m
thought for 32.2 seconds
Yes, I can confirm that by default, Prefect tasks have no retries (effectively 0). Here's the detailed explanation: 1. The default value for
retries
is
None
, which means no retries will occur unless explicitly specified 2. To enable retries, you need to explicitly set the
retries
parameter in the task decorator Here's how you can configure retries:
Copy code
python
from prefect import task

# No retries (default behavior)
@task
def my_task():
    pass

# With 3 retries
@task(retries=3)
def my_task_with_retries():
    pass

# With 3 retries and specific delay between attempts
@task(retries=3, retry_delay_seconds=10)
def my_task_with_retries_and_delay():
    pass

# With retries and increasing delay between attempts
@task(retries=3, retry_delay_seconds=[1, 5, 10])
def my_task_with_variable_delays():
    pass
You can find more detailed information about configuring retries in the Prefect documentation.