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.
The
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
google.appengine.api.taskqueue
module.
- TaskRetryOptions()
- Properties
Constructor
- class TaskRetryOptions (** kw )
-
The options used to decide when to retry a failed task.
- ** kw
- Values for the instance's properties, as keyword arguments.
Properties
A Task instance has the following properties:
-
task_retry_limit
-
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 withtask_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. -
task_age_limit
-
The time limit for retrying a failed task, specified in seconds and measured from when the task was first run. If
task_retry_limit
is also specified, the task is retried until both limits are reached. -
min_backoff_seconds
-
The minimum number of seconds to wait before retrying a task after failure.
-
max_backoff_seconds
-
The maximum number of seconds to wait before retrying a task after failure.
-
max_doublings
-
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.