alert-oil-1341
07/24/2025, 1:02 PMjolly-florist-66728
07/24/2025, 1:02 PMmap_task
. The timeout
parameter in the @task
decorator applies to each subtask instance, so if a pod hangs (e.g., due to CPU constraints), it will be killed after the specified timeout. Similarly, the retries
parameter controls how many times each subtask is retried on failure, including timeouts. This behavior is supported for both regular and map tasks, and system-level retries (e.g., for infrastructure failures) are managed by the platform configuration, while user-level retries are set in the decorator. For example:
from datetime import timedelta
from flytekit import task, map_task
@task(timeout=timedelta(minutes=10), retries=2)
def my_subtask(x: int) -> int:
# Task logic here
...
result = map_task(my_subtask)(x=[1, 2, 3])
If a subtask times out, it will be retried up to the specified limit, and the timeout applies to each attempt individually. Manual pod deletion will also trigger a retry if within the retry budget. For more, see Retries and timeouts and Optimizing tasks.
Would you like more detail on how this works with map tasks and platform-level settings?
Sources:
- Optimizing tasks
- Retries and timeouts 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.