Support Cloud Tasks backend and transactional tasks for Push Queues
Pre-releaseWhat's New in this Release
This release introduces native Google Cloud Tasks backend support and Transactional Task execution for App Engine Standard Push Queues in the Python SDK (google.appengine.api.taskqueue), enabled via the APPENGINE_USE_CLOUDTASK_PUSH_QUEUE=true environment variable.
Applications using standard taskqueue APIs can now route push traffic through Cloud Tasks (using google-cloud-tasks / GAPIC tasks_v2beta3) without modifying application code.
🚀 Key Features & Enhancements
-
Cloud Tasks Push Queue Routing:
- Automatically redirects
Queue.add(),Queue.add_async(),Task.add(), andTask.add_async()to Google Cloud Tasks whenAPPENGINE_USE_CLOUDTASK_PUSH_QUEUE=true. - Supports single (
create_task) and bulk task creation (batch_create_tasks). - Supports queue maintenance APIs:
delete_tasks(),purge(), andfetch_statistics().
- Automatically redirects
-
Transactional Tasks Support (Transactional Outbox Pattern):
- Supports adding tasks inside active transactions for both NDB and DB / Datastore via Datastore staging (
_AE_PendingCloudTask). - NDB: Uses
ndb.get_context().call_on_commit(...)for immediate post-commit task dispatch. - DB / Datastore: Added
_on_commit_callbackstoTransactionalConnectionindatastore_rpcto trigger post-commit dispatch upon transaction commit.
- Supports adding tasks inside active transactions for both NDB and DB / Datastore via Datastore staging (
-
Background Sweeper Middleware:
- Added
CloudTaskSweepMiddlewareto intercept cron requests on/_ah/cloudtask/sweepto ensure at-least-once delivery for pending transactional tasks.
- Added
-
Task Parameter & Retry Mapping:
- Converts
countdownandetato UTCschedule_timetimestamps. - Maps
TaskRetryOptions(retry limits, backoff intervals, max doublings) to Cloud Tasks retry configs. - Retains App Engine target headers, HTTP methods, and dispatch targets.
- Converts
-
Error Translation:
- Translates Cloud Tasks gRPC and REST status codes (e.g.
NOT_FOUND,ALREADY_EXISTS,INVALID_ARGUMENT) into nativetaskqueueexceptions (UnknownQueueError,TaskAlreadyExistsError,InvalidTaskError).
- Translates Cloud Tasks gRPC and REST status codes (e.g.
-
Pull Queue Backward Compatibility:
- Pull queues continue to route through the standard TaskQueue stub.
⚙️ How to Enable
To use Cloud Tasks as the backend for TaskQueue Push Queues, add the following environment variable to your app.yaml:
env_variables:
APPENGINE_USE_CLOUDTASK_PUSH_QUEUE: 'true'