Utilities¶
fastapi_gcp_tasks.utils ¶
location_path ¶
Helper function to construct a location path for Cloud Scheduler.
queue_path ¶
Helper function to construct a queue path for Cloud Tasks.
ensure_queue ¶
Helper function to ensure a Cloud Tasks queue exists.
If the queue already exists, this function will not raise an error. If the queue does not exist, it will be created with the provided kwargs.
Source code in fastapi_gcp_tasks/utils.py
ensure_queue_async
async
¶
Helper function to ensure a Cloud Tasks queue exists, using an async client.
If the queue already exists, this function will not raise an error. If the queue does not exist, it will be created with the provided kwargs.
Recommended usage is to call this once from your FastAPI lifespan.
Source code in fastapi_gcp_tasks/utils.py
emulator_client ¶
Helper function to create a CloudTasksClient from an emulator host.
Source code in fastapi_gcp_tasks/utils.py
async_emulator_client ¶
Helper function to create a CloudTasksAsyncClient from an emulator host.
Note: grpc.aio channels bind to the event loop active at construction, so call
this inside a running event loop, or pass it as a client factory to
AsyncDelayedRouteBuilder (e.g. client=lambda: async_emulator_client(host=...)).