Tasks executing in the task queue can fail for many reasons. If a task fails to execute (by returning any HTTP status code outside of the range 200-299), App Engine retries the task until it succeeds. By default, the system gradually reduces the retry rate to avoid flooding your application with too many requests, but schedules retry attempts to recur at a maximum of once per hour until the task succeeds. See also Python Task Queue Configuration, Task class retry options, and The rate of task execution.
TaskRetryOptions class provides the properties that you can use to decide when to retry a failed task at runtime.
Note: All of the properties below apply to push queues. The only property that applies to pull queues is task_retry_limit
TaskRetryOptions is provided by the
- class TaskRetryOptions (**kw)
The options used to decide when to retry a failed task.
- Values for the instance's properties, as keyword arguments.
A Task instance has the following properties:
The maximum number of retry attempts for a failed task.
In push queues, the counter is incremented each time App Engine tries the task, up to the specified
task_retry_limit. If specified with
task_age_limit, App Engine retries the task until both limits are reached.
In pull queues, the counter is incremented each time the task is leased, up to the specified
task_retry_limit. Tasks are deleted automatically once they have been leased the number of times specified in the limit.
The time limit for retrying a failed task, specified in seconds and measured from when the task was first run. If
task_retry_limitis also specified, the task is retried until both limits are reached.
The minimum number of seconds to wait before retrying a task after failure.
The maximum number of seconds to wait before retrying a task after failure.
The maximum number of times that the interval between failed task retries will be doubled before the increase becomes constant. The constant is: 2**(max_doublings - 1) * min_backoff_seconds.