Skip to main content

ArangoDbBackend

ArangoDb backend.

Attributes​

AttributeTypeDescription
hoststring = 127.0.0.1The hostname or IP address of the ArangoDB server used for establishing a connection.
portstring = 8529The network port number on which the ArangoDB server is listening for incoming requests.
databasestring = celeryThe name of the specific ArangoDB database where task results and metadata are stored.
collectionstring = celeryThe name of the ArangoDB collection used to store key-value pairs for task data.
usernamestringThe username used for authenticating the connection to the ArangoDB server.
passwordstringThe password used for authenticating the connection to the ArangoDB server.
http_protocolstring = httpThe transfer protocol used for the ArangoDB connection URL, defaulting to http.
verifyboolean = falseA flag indicating whether to verify SSL certificates when connecting to the ArangoDB server via HTTPS.
key_ttype = strUse str as arangodb key not bytes.

Constructor​

Signature​

def ArangoDbBackend(
url: str = None,
*args: tuple,
**kwargs: dict
) - > null

Parameters​

NameTypeDescription
urlstr = NoneThe ArangoDB connection URL containing credentials, host, and database information.
*argstupleVariable length argument list passed to the parent class.
**kwargsdictArbitrary keyword arguments passed to the parent class.

Methods​


connection()​

@classmethod
def connection() - > pyArango.connection.Connection

Connect to the arangodb server.

Returns​

TypeDescription
pyArango.connection.ConnectionThe active connection object to the ArangoDB server instance

db()​

@classmethod
def db() - > pyArango.database.Database

Database Object to the given database.

Returns​

TypeDescription
pyArango.database.DatabaseThe 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​

TypeDescription
datetime.timedeltaA 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​

NameTypeDescription
keystrThe unique identifier for the task record to be retrieved

Returns​

TypeDescription
anyThe 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​

NameTypeDescription
keystrThe unique identifier used as the document key in ArangoDB
valueanyThe task result or state data to be persisted

Returns​

TypeDescription
nullnull

mget()​

@classmethod
def mget(
keys: list
) - > generator

Fetches multiple task records simultaneously for a given list of keys using an AQL query.

Parameters​

NameTypeDescription
keyslistA sequence of unique identifiers for the task records to retrieve

Returns​

TypeDescription
generatorA 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​

NameTypeDescription
keystrThe unique identifier of the document to be deleted

Returns​

TypeDescription
nullnull

cleanup()​

@classmethod
def cleanup() - > null

Deletes expired task records from the collection based on the configured expiration threshold.

Returns​

TypeDescription
nullnull