File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/celery.cpython-310.pyc
Back
o ;jQ � @ s� d Z ddlZddlmZ e�e�ZzddlmZ ddl m Z dZW n ey, dZY nw dd � Z d dd�ZdS )a� Support for scheduling celery tasks. The worker is independent of salt and thus can run in a different virtualenv or on a different python version, as long as broker, backend and serializer configurations match. Also note that celery and packages required by the celery broker, e.g. redis must be installed to load the salt celery execution module. .. note:: A new app (and thus new connections) is created for each task execution � N)�SaltInvocationError)�Celery)�TimeoutErrorTFc C s t sdS dS )z. Only load if celery libraries exist. )Fz?The celery module could not be loaded: celery library not foundT)� HAS_CELERY� r r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/celery.py�__virtual__ s r � �?c C s, |st d��t||dd��}|r|j�|� |�� �Z |pg }|p"i }|j| ||d�} |rmz| j|||| d�W W d � W d � S tyl } zt� d� | rU� W Y d}~W d � W d � dS d}~ww W d � n1 sww Y W d � dS W d � dS 1 s�w Y dS )a� Execute celery tasks. For celery specific parameters see celery documentation. CLI Example: .. code-block:: bash salt '*' celery.run_task tasks.sleep args=[4] broker=redis://localhost \ backend=redis://localhost wait_for_result=true task_name The task name, e.g. tasks.sleep args Task arguments as a list kwargs Task keyword arguments broker Broker for celeryapp, see celery documentation backend Result backend for celeryapp, see celery documentation wait_for_result Wait until task result is read from result backend and return result, Default: False timeout Timeout waiting for result from celery, see celery AsyncResult.get documentation propagate Propagate exceptions from celery task, see celery AsyncResult.get documentation, Default: True interval Interval to check for task result, see celery AsyncResult.get documentation, Default: 0.5 no_ack see celery AsyncResult.get documentation. Default: True raise_timeout Raise timeout exception if waiting for task result times out. Default: False config Config dict for celery app, See celery documentation zbroker parameter is requiredF)�broker�backendZset_as_current)�args�kwargs)�timeout� propagate�interval�no_ackNz<Waiting for the result of a celery task execution timed out.) r r Zconf�update� connectionZ send_task�getr �log�error)Z task_namer r r r Zwait_for_resultr r r r Z raise_timeoutZconfigZappZasync_result�exr r r �run_task$ sF = ���� ������"�r )NNNNFNTr TTN)�__doc__�loggingZsalt.exceptionsr � getLogger�__name__r Zceleryr Zcelery.exceptionsr r �ImportErrorr r r r r r �<module> s0 ��
| ver. 1.4 |
Github
|
.
| PHP 8.2.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings