Tate Wilks
05/21/2026, 8:09 PMtimeout_seconds control the maximum time allowed for the task across all retries or for a single attempt?Marvin
05/21/2026, 8:09 PMMarvin
05/21/2026, 8:11 PMtimeout_seconds applies to a single attempt.
If a task times out and has retries configured, the retry starts with a fresh timeout window. It is not a cumulative limit across all attempts.
So for example:
python
@task(timeout_seconds=30, retries=2)
def my_task():
...
This allows up to 3 attempts total, and each attempt can run for up to 30 seconds.
I verified this against Prefect 3.x source/tests:
- The task engine wraps execution in a timeout context for each run attempt
- There is also a test specifically confirming that the timeout deadline resets on retry
If helpful, I can also show what state transitions look like when a timeout triggers a retry.