Skip to main content
Set how long tasks can run, wait in a queue, and retry.

Execution Timeouts

Use timeout=-1 to disable timeouts on functions and task queues. Endpoints are capped at 600 seconds, including when timeout is nonpositive. Use a task queue for longer jobs.

Pending-task Expiry

TaskPolicy(ttl=...) limits how long a task may remain pending. Defaults are 12 hours for functions and scheduled jobs, 2 hours for task queues, and 600 seconds for endpoints. The gateway caps an explicitly configured TTL at 24 hours.
Client and proxy timeouts apply separately.

Retries

Functions, schedules, and task queues default to 3 retries. Configure retries on the decorator; the gateway caps retries at 5. Endpoint and ASGI requests have automatic task retries disabled. A task queue can retry selected exceptions with retry_for:
Make retried tasks safe to run more than once. retry_for is only available on task queues. Nonzero TaskPolicy.timeout and max_retries override the decorator; zero uses its settings. Set retries=0 on the decorator to disable retries.

Container Lifetime

keep_warm_seconds controls how long idle containers stay running. For sandboxes, it sets the sandbox lifetime. Neither setting is a task execution timeout.