Skip to content

feat: Complete Cloud Tasks API integration for PushQueue (v2beta2)#143

Closed
riddhi-shivhare wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
riddhi-shivhare:new-CT-changes
Closed

feat: Complete Cloud Tasks API integration for PushQueue (v2beta2)#143
riddhi-shivhare wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
riddhi-shivhare:new-CT-changes

Conversation

@riddhi-shivhare
Copy link

Overview

This PR introduces the capability to route App Engine TaskQueue (PushQueue) requests directly to the Cloud Tasks API, bypassing the legacy Appserver entirely. This implementation is designed to provide full backward compatibility, allowing users to migrate to the modern Cloud Tasks backend without requiring any changes to their application code.

Key Architectural Changes (vs. Legacy Appserver)

  • Direct gRPC Communication: Replaces legacy internal RPCs (apiproxy_stub_map.MakeSyncCall) with direct calls to the Cloud Tasks frontend using the tasks_v2beta2.CloudTasksClient() via a thread-safe Singleton.
  • Payload Translation: Dynamically translates legacy App Engine TaskQueueAddRequest protobufs into modern Cloud Tasks AppEngineHttpRequest payloads. This includes mapping HTTP methods, transferring raw byte payloads, preserving headers, and formatting ETAs to schedule_time.
  • Transparent RPC Lifecycle Mocking: The legacy SDK heavily relies on asynchronous UserRPC objects (expecting get_result, check_success, and state assertions) even for synchronous calls. This PR introduces a _SimpleSyncRPC wrapper that intercepts and flawlessly mimics the Appserver's response lifecycle back to the caller.
  • Queue Statistics Mapping: Intercepts FetchQueueStats requests and maps the modern Cloud Tasks QueueStats object back into the legacy QueueStatistics format. This accurately translates fields like tasks_count to tasks, and converts oldest_estimated_arrival_time back to legacy POSIX microsecond timestamps (oldest_eta_usec).
  • Opt-In Toggle: The legacy Appserver path remains the default. The new direct Cloud Tasks routing is safely protected behind the GAE_USE_CLOUDTASKS_PATH=true environment variable.
  • UI Tracking: Injects a new _backend_used attribute into Task and QueueStatistics objects to help demo/monitoring apps visibly differentiate between "Cloud Tasks" and "Legacy TaskQueue" executions.

Supported Operations

  • add (Single Push Tasks)
  • delete_tasks (Single Task Deletion)
  • purge (Queue Purging)
  • fetch_statistics (Rich queue stats mapping)

(Note: Batch operations like BulkAdd and batch deletes are currently safeguarded with NotImplementedError while the underlying batch APIs are developed, and will be implemented in a subsequent PR).

@riddhi-shivhare riddhi-shivhare deleted the new-CT-changes branch February 26, 2026 17:45
@riddhi-shivhare riddhi-shivhare restored the new-CT-changes branch February 26, 2026 17:49
@riddhi-shivhare riddhi-shivhare deleted the new-CT-changes branch February 26, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant