Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/celery/backends/__pycache__/cassandra.cpython-39.pyc
Ðазад
a t�h.# � @ s� d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z z$ddl Z ddlZ ddlZ ddl Z W n eyv dZ Y n0 dZee�Zd Zd ZdZdZd ZdZdZdZdd� ZG dd� de �ZdS )z@Apache Cassandra result store backend using the DataStax driver.� N)�states)�ImproperlyConfigured)� get_logger� )�BaseBackend)�CassandraBackendz You need to install the cassandra-driver library to use the Cassandra backend. See https://github.com/datastax/python-driver z� CASSANDRA_AUTH_PROVIDER you provided is not a valid auth_provider class. See https://datastax.github.io/python-driver/api/cassandra/auth.html. z(Cassandra backend improperly configured.z!Cassandra backend not configured.z� INSERT INTO {table} ( task_id, status, result, date_done, traceback, children) VALUES ( %s, %s, %s, %s, %s, %s) {expires}; z] SELECT status, result, date_done, traceback, children FROM {table} WHERE task_id=%s LIMIT 1 z� CREATE TABLE {table} ( task_id text, status text, result blob, date_done timestamp, traceback blob, children blob, PRIMARY KEY ((task_id), date_done) ) WITH CLUSTERING ORDER BY (date_done DESC); z USING TTL {0} c C s t | d�S )N�utf8)�bytes)�x� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/celery/backends/cassandra.py�buf_tC s r c sb e Zd ZdZdZdZdZd� fdd� Zddd �Zdd d�Z ddd �Z dd� Zd� fdd� Z� Z S )r aG Cassandra/AstraDB backend utilizing DataStax driver. Raises: celery.exceptions.ImproperlyConfigured: if module :pypi:`cassandra-driver` is not available, or not-exactly-one of the :setting:`cassandra_servers` and the :setting:`cassandra_secure_bundle_path` settings is set. NT�R# c s� t � jf i |�� tstt��| jj}|p4|�dd �| _|pF|�dd �| _ |pX|�dd �| _ |pj|�dd �| _|p||�dd �| _|�di �| _ | jp�| j } | r�| jr�| js�tt��| jr�| j r�tt��|p�|�dd �} | d ur�t�| �nd| _|�d �p�d }|�d��p d }ttj|tjj�| _ttj|tjj�| _d | _|�dd �} |�d d �}| �r�|�r�ttj| d �}|�sztt��|f i |��| _d | _d | _d | _d | _t� � | _!d S )NZcassandra_serversZcassandra_secure_bundle_pathZcassandra_portZcassandra_keyspaceZcassandra_table�cassandra_optionsZcassandra_entry_ttl� Zcassandra_read_consistency�LOCAL_QUORUMZcassandra_write_consistencyZcassandra_auth_providerZcassandra_auth_kwargs)"�super�__init__� cassandrar �E_NO_CASSANDRA�app�conf�get�servers�bundle_path�port�keyspace�tabler �E_CASSANDRA_NOT_CONFIGURED�E_CASSANDRA_MISCONFIGURED� Q_EXPIRES�format� cqlexpires�getattrZConsistencyLevelr �read_consistency�write_consistency� auth_provider�auth�!E_NO_SUCH_CASSANDRA_AUTH_PROVIDER�_cluster�_session�_write_stmt� _read_stmt� threading�RLock�_lock)�selfr r r Z entry_ttlr r �kwargsr Z db_directions�expiresZ read_consZ write_consr&