S3Backend
An S3 task result store.
Attributes
| Attribute | Type | Description |
|---|---|---|
| endpoint_url | string | The custom URL for the S3 service endpoint used to connect to non-AWS S3 compatible services. |
| aws_region | string | The AWS region name where the S3 bucket is located for establishing the session connection. |
| aws_access_key_id | string | The AWS access key credential used for authenticating requests to the S3 service. |
| aws_secret_access_key | string | The AWS secret access key credential used for authenticating requests to the S3 service. |
| bucket_name | string | The name of the S3 bucket where task results are stored; this value is required for the backend to function. |
| base_path | string | An optional prefix or directory path prepended to all keys stored in the S3 bucket. |
| _s3_resource | object | The internal boto3 S3 resource instance used to perform object operations like get, put, and delete. |
Constructor
Signature
def S3Backend(
**kwargs: dict
)
Parameters
| Name | Type | Description |
|---|---|---|
| **kwargs | dict | Arbitrary keyword arguments passed to the parent KeyValueStoreBackend class. |
Signature
def S3Backend(
**kwargs: dict
)
Parameters
| Name | Type | Description |
|---|---|---|
| **kwargs | dict | Arbitrary keyword arguments passed to the parent KeyValueStoreBackend class. |
Methods
get()
@classmethod
def get(
key: str | bytes
) - > str | bytes | null
Retrieves the content of a task result from S3, returning None if the key does not exist.
Parameters
| Name | Type | Description |
|---|---|---|
| key | `str | bytes` |
Returns
| Type | Description |
|---|---|
| `str | bytes |
set()
@classmethod
def set(
key: str | bytes,
value: str | bytes
)
Uploads the provided value to the S3 bucket using the specified key.
Parameters
| Name | Type | Description |
|---|---|---|
| key | `str | bytes` |
| value | `str | bytes` |
delete()
@classmethod
def delete(
key: str | bytes
)
Removes the task result object associated with the given key from the S3 bucket.
Parameters
| Name | Type | Description |
|---|---|---|
| key | `str | bytes` |