# The TaskRetryOptions Class - Google App Engine - Google Code

English ▼
Skip to page content Skip to main navigation
e.g. "templates" or "datastore"

# The TaskRetryOptions Class

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
  - min_backoff_seconds
  - max_backoff_seconds
  - task_age_limit
  - max_doublings
  - task_retry_limit

## Constructor

class TaskRetryOptions ()

  The options used to decide when to retry a failed task.

## Properties

A Task instance has the following properties:

`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.

`task_age_limit`

  The number of seconds to wait before retrying a failed task, measured from the time the task was created, rounded up to the nearest integer. If `task_retry_limit` is also specified, the task is retried until both limits are reached.

`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.

`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 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.