ArangoDbBackend
ArangoDb backend.
Attributes
| Attribute | Type | Description |
|---|---|---|
| host | string = 127.0.0.1 | The hostname or IP address of the ArangoDB server used for establishing a connection. |
| port | string = 8529 | The network port number on which the ArangoDB server is listening for incoming requests. |
| database | string = celery | The name of the specific ArangoDB database where task results and metadata are stored. |
| collection | string = celery | The name of the ArangoDB collection used to store key-value pairs for task data. |
| username | string | The username used for authenticating the connection to the ArangoDB server. |
| password | string | The password used for authenticating the connection to the ArangoDB server. |
| http_protocol | string = http | The transfer protocol used for the ArangoDB connection URL, defaulting to http. |
| verify | boolean = false | A flag indicating whether to verify SSL certificates when connecting to the ArangoDB server via HTTPS. |
| key_t | type = str | Use str as arangodb key not bytes. |
Constructor
Signature
def ArangoDbBackend(
url: str = None,
*args: tuple,
**kwargs: dict
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| url | str = None | The ArangoDB connection URL containing credentials, host, and database information. |
| *args | tuple | Variable length argument list passed to the parent class. |
| **kwargs | dict | Arbitrary keyword arguments passed to the parent class. |
Methods
connection()
@classmethod
def connection() - > pyArango.connection.Connection
Connect to the arangodb server.
Returns
| Type | Description |
|---|---|
pyArango.connection.Connection | The active connection object to the ArangoDB server instance |
db()
@classmethod
def db() - > pyArango.database.Database
Database Object to the given database.
Returns
| Type | Description |
|---|---|
pyArango.database.Database | The specific database object used for storing and retrieving task data |
expires_delta()
@classmethod
def expires_delta() - > datetime.timedelta
Calculates the expiration time as a timedelta object based on the backend configuration.
Returns
| Type | Description |
|---|---|
datetime.timedelta | A timedelta representing the duration after which records are considered expired |
get()
@classmethod
def get(
key: str
) - > any
Retrieves the task data associated with a specific key from the ArangoDB collection.
Parameters
| Name | Type | Description |
|---|---|---|
| key | str | The unique identifier for the task record to be retrieved |
Returns
| Type | Description |
|---|---|
any | The task data if the key exists, otherwise None |
set()
@classmethod
def set(
key: str,
value: any
) - > null
Stores or updates a task record in the collection using an UPSERT operation.
Parameters
| Name | Type | Description |
|---|---|---|
| key | str | The unique identifier used as the document key in ArangoDB |
| value | any | The task result or state data to be persisted |
Returns
| Type | Description |
|---|---|
null | null |
mget()
@classmethod
def mget(
keys: list
) - > generator
Fetches multiple task records simultaneously for a given list of keys using an AQL query.
Parameters
| Name | Type | Description |
|---|---|---|
| keys | list | A sequence of unique identifiers for the task records to retrieve |
Returns
| Type | Description |
|---|---|
generator | A generator yielding the task data for each found key |
delete()
@classmethod
def delete(
key: str
) - > null
Removes a specific task record from the ArangoDB collection by its key.
Parameters
| Name | Type | Description |
|---|---|---|
| key | str | The unique identifier of the document to be deleted |
Returns
| Type | Description |
|---|---|
null | null |
cleanup()
@classmethod
def cleanup() - > null
Deletes expired task records from the collection based on the configured expiration threshold.
Returns
| Type | Description |
|---|---|
null | null |