HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/local/lib/python3.9/site-packages/celery/events/__pycache__/snapshot.cpython-39.pyc
a

X>h��@s�dZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZdd	lmZd
Zed�ZGdd
�d
�Zddd�ZdS)aSPeriodically store events in a database.

Consuming the events as a stream isn't always suitable
so this module implements a system to take snapshots of the
state of a cluster at regular intervals.  There's a full
implementation of this writing the snapshots to a database
in :mod:`djcelery.snapshots` in the `django-celery` distribution.
�)�TokenBucket)�	platforms)�app_or_default)�Signal)�instantiate)�
get_logger)�rate)�Timer)�Polaroid�evcamzcelery.evcamc@s�eZdZdZdZeddhd�Zedd�ZdZdZ	dZ
ddd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS) r
zRecord event snapshots.N�shutter_signal�state)�nameZproviding_args�cleanup_signal)rF��?� �@cCsJt|�|_||_||_||_|p*|jp*t�|_t|_|oBtt	|��|_
dS�N)r�appr
�freq�cleanup_freq�timerr	�loggerrr�maxrate)�selfr
rrrrr�r�@/usr/local/lib/python3.9/site-packages/celery/events/snapshot.py�__init__#s
zPolaroid.__init__cCs,|j�|j|j�|_|j�|j|j�|_dSr)rZcall_repeatedlyr�capture�_trefr�cleanup�_ctref�rrrr�install-s�zPolaroid.installcCsdSrr)rr
rrr�
on_shutter3szPolaroid.on_shuttercCsdSrrr!rrr�
on_cleanup6szPolaroid.on_cleanupcCs&t�d�|jj|jd�|��dS)NzCleanup: Running...�Zsender)r�debugr�sendr
r$r!rrrr9s
zPolaroid.cleanupcCsB|jdus|j��r>t�d|j�|jj|jd�|�|j�dS)NzShutter: %sr%)rZcan_consumerr&r
rr'r#r!rrr�shutter>szPolaroid.shuttercCs|jj|j|jd�dS)N)�clear_after)r
Zfreeze_whiler(r)r!rrrrDszPolaroid.capturecCs,|jr|��|j��|jr(|j��dSr)r�cancelr r!rrrr*Gs

zPolaroid.cancelcCs|��|Sr)r"r!rrr�	__enter__NszPolaroid.__enter__cGs|��dSr)r*)r�exc_inforrr�__exit__RszPolaroid.__exit__)rNrNN)�__name__�
__module__�__qualname__�__doc__rrrrr)rr rr"r#r$rr(rr*r+r-rrrrr
s&
�

r
rNc
Ks�t|�}|rt�|�|j�||�td|�d|�d��|j��}	t||	||||d�}
|
�	�|�
�}|jj|d|	jid�}z<z|j
dd�Wnty�t�Yn0W|
��|��n|
��|��0dS)	zStart snapshot recorder.z -> evcam: Taking snapshots with z (every z secs.))rrrr�*)�handlersN)�limit)rrZcreate_pidlock�logZsetup_logging_subsystem�print�events�Staterr"Zconnection_for_readZReceiver�eventr�KeyboardInterrupt�
SystemExitr*�close)
ZcamerarrZloglevel�logfileZpidfilerr�kwargsr
Zcam�conn�recvrrrrVs*


�
�r)rNrNNNN)r1Zkombu.utils.limitsrZceleryrZ
celery.apprZcelery.utils.dispatchrZcelery.utils.importsrZcelery.utils.logrZcelery.utils.timerZcelery.utils.timer2r	�__all__rr
rrrrr�<module>s>�