Python 2.7 has reached end of supportand will bedeprecatedon January 31, 2026. After deprecation, you won't be able to deploy Python 2.7applications, even if your organization previously used an organization policy tore-enable deployments of legacy runtimes. Your existing Python2.7 applications will continue to run and receive traffic after theirdeprecation date. We recommend thatyoumigrate to the latest supported version of Python.

Retrying Failed Push Tasks

Push tasks being processed via a task queue can fail for many reasons. If a handlerfails to execute a task (and therefore returns any HTTP status code outside ofthe range 200–299), App Engine retries the task until it succeeds.

This API is supported for first-generation runtimes and can be used whenupgrading to corresponding second-generation runtimes. If you are updating to the App Engine Python 3 runtime, refer to themigration guide to learn about your migration options for legacy bundled services.

By default, the system gradually reduces the retry rate to avoid overloading your application with too manyrequests, but schedules retry attempts to recur at a maximum of once per houruntil the task succeeds.Important:Retry options can be configured for the queue as well specified on theTask object. When both are specified, thelatter takes precedence.

Retrying tasks

You can customize your own scheme for task retries byadding theretryparameterselement inqueue.yaml. Thisaddition allows you to specify the maximum number of times to retry failed tasksin a specific queue. You can also set a time limit for retry attempts andcontrol the interval between attempts.

The following example demonstrates various retry scenarios:

  • Infooqueue, tasks are retried up to seven times and for up to two daysfrom the first execution attempt. After both limits are passed, it failspermanently.
  • Inbarqueue, App Engine attempts to retry tasks, increasing the intervallinearly between each retry until reaching the maximum backoff and retryingindefinitely at the maximum interval (so the intervals between requests are10s, 20s, 30s, ..., 190s, 200s, 200s, ...).
  • Inbazqueue, the retry interval starts at 10s, then doubles three times,then increases linearly, and finally retries indefinitely at themaximum interval (so the intervals between requests are10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, ...).
queue:-name:fooqueuerate:1/sretry_parameters:task_retry_limit:7task_age_limit:2d-name:barqueuerate:1/sretry_parameters:min_backoff_seconds:10max_backoff_seconds:200max_doublings:0-name:bazqueuerate:1/sretry_parameters:min_backoff_seconds:10max_backoff_seconds:300max_doublings:3

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.