GCSBackend
Google Cloud Storage task result backend.
Uses Firestore for chord ref count.
Attributes
| Attribute | Type | Description |
|---|---|---|
| implements_incr | boolean = True | Boolean flag indicating that this backend supports atomic increment operations used for chord synchronization. |
| supports_native_join | boolean = True | Boolean flag indicating that this backend can perform native join operations for task groups. |
Constructor
Signature
def GCSBackend(
**kwargs: dict
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| **kwargs | dict | Arbitrary keyword arguments passed to the base class constructor. |
Methods
firestore_client()
@classmethod
def firestore_client() - > google.cloud.firestore.Client
Returns a firestore client.
Returns
| Type | Description |
|---|---|
google.cloud.firestore.Client | A thread-safe Firestore client instance associated with the configured project. |
incr()
@classmethod
def incr(
key: bytes
) - > int
Increments the chord counter for a specific key in Firestore using an atomic operation with built-in retry logic for conflicts.
Parameters
| Name | Type | Description |
|---|---|---|
| key | bytes | The unique identifier for the chord tracking document in Firestore. |
Returns
| Type | Description |
|---|---|
int | The new integer value of the chord counter after the increment. |
on_chord_part_return()
@classmethod
def on_chord_part_return(
request: object,
state: string,
result: any
) - > null
Chord part return callback. Called for each task in the chord. Increments the counter stored in Firestore. If the counter reaches the number of tasks in the chord, the callback is called. If the callback raises an exception, the chord is marked as errored. If the callback returns a value, the chord is marked as successful.
Parameters
| Name | Type | Description |
|---|---|---|
| request | object | The request object for the individual task part, containing group and chord metadata. |
| state | string | The current execution state of the task part. |
| result | any | The return value of the individual task part. |
Returns
| Type | Description |
|---|---|
null | null |