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/worker/__pycache__/components.cpython-39.pyc
a

X>hI�@sdZddlZddlZddlmZddlmZmZddlm	Z	m
Z
ddlmZ
ddlmZddlmZdd	lmZdd
lmZddlmZdZd
dhZdZdZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�Z Gdd�dej�Z!Gdd�dej�Z"dS)zWorker-level Bootsteps.�N)�Hub)�get_event_loop�set_event_loop)�	DummyLock�LaxBoundedSemaphore)�Timer)�	bootsteps)�_set_task_join_will_block)�ImproperlyConfigured)�
IS_WINDOWS)�
worker_logger)rr�Pool�Beat�StateDB�Consumer�eventlet�geventzO-B option doesn't work with eventlet/gevent pools: use standalone beat instead.z�
The worker_pool setting shouldn't be used to select the eventlet/gevent
pools, instead you *must use the -P* argument so that patches are applied
as early as possible.
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	rzTimer bootstep.cCsD|jrtdd�|_n,|js$|jj|_|j|j|j|j|j	d�|_dS)Ng$@)�max_interval)rZon_errorZon_tick)
�
use_eventloop�_Timer�timerZ	timer_cls�pool_clsr�instantiateZtimer_precision�on_timer_error�
on_timer_tick��self�w�r�B/usr/local/lib/python3.9/site-packages/celery/worker/components.py�create#s
�zTimer.createcCstjd|dd�dS)NzTimer error: %rT)�exc_info)�logger�error)r�excrrrr1szTimer.on_timer_errorcCst�d|�dS)Nz Timer wake-up! Next ETA %s secs.)r"�debug)r�delayrrrr4szTimer.on_timer_tickN)�__name__�
__module__�__qualname__�__doc__r rrrrrrr srcsVeZdZdZefZ�fdd�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Z�Z
S)rzWorker starts the event loop.csd|_t�j|fi|��dS�N)�hub�super�__init__�rr�kwargs��	__class__rrr.=szHub.__init__cCs|jSr+)rrrrr�
include_ifAszHub.include_ifcCsFt�|_|jdur8t|jdd�}t|r*|nt|j��|_|�|�|S)NZrequires_hub)rr,�getattrZ	_conninfor�_Hubr�_patch_thread_primitives)rrZrequired_hubrrrr Ds
�
z
Hub.createcCsdSr+rrrrr�startMsz	Hub.startcCs|j��dSr+�r,�closerrrr�stopPszHub.stopcCs|j��dSr+r8rrrr�	terminateSsz
Hub.terminatecCs:t�|jj_zddlm}Wnty.Yn0t|_dS)Nr)�pool)r�app�clock�mutexZbilliardr<�ImportError�Lock)rrr<rrrr6VszHub._patch_thread_primitives)r'r(r)r*r�requiresr.r3r r7r:r;r6�
__classcell__rrr1rr8s	rcsPeZdZdZefZd�fdd�	Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Z�ZS)r
a
Bootstep managing the worker pool.

    Describes how to initialize the worker pool, and starts and stops
    the pool during worker start-up/shutdown.

    Adds attributes:

        * autoscale
        * pool
        * max_concurrency
        * min_concurrency
    Ncs�d|_d|_|j|_|j|_t|t�rN|�d�\}}}t|�|rHt|�pJdg}||_	|j	rh|j	\|_|_t
�j|fi|��dS)N�,r)r<�max_concurrency�concurrency�min_concurrency�optimization�
isinstance�str�	partition�int�	autoscaler-r.)rrrMr0Zmax_c�_Zmin_cr1rrr.rs
z
Pool.__init__cCs|jr|j��dSr+)r<r9rrrrr9sz
Pool.closecCs|jr|j��dSr+)r<r;rrrrr;�szPool.terminatecCs�d}d}|jjjtvr$t�tt��|jp.t	}|j
}|j|_|s~t
|�}|_|jj|_|jj|_d}|jr~|jjr~|j|_|j}|j|j|j
|j|jf|j|j|j|j|jo�||j|||d||j|jd�}|_ t!|j"�|S)N�dT)ZinitargsZmaxtasksperchild�max_memory_per_child�timeoutZsoft_timeoutZputlocksZlost_worker_timeout�threads�max_restarts�
allow_restartZforking_enable�	semaphoreZsched_strategyr=)#r=�confZworker_pool�GREEN_POOLS�warnings�warn�UserWarning�W_POOL_SETTINGrrrGZ
_process_task�process_taskrrU�acquireZ_quick_acquire�releaseZ_quick_releaseZ
pool_putlocksrZuses_semaphoreZ_process_task_semZ
pool_restartsr�hostnameZmax_tasks_per_childrPZ
time_limitZsoft_time_limitZworker_lost_waitrHr<r	Ztask_join_will_block)rrrUrSZthreadedZprocsrTr<rrrr �sD


�
zPool.createcCsd|jr|jjndiS)Nr<zN/A)r<�inforrrrr`�sz	Pool.infocCs|j�|�dSr+)r<�register_with_event_loop)rrr,rrrra�szPool.register_with_event_loop)N)
r'r(r)r*rrBr.r9r;r r`rarCrrr1rr
bs

$r
cs2eZdZdZdZdZd�fdd�	Zdd�Z�ZS)	rzWStep used to embed a beat process.

    Enabled when the ``beat`` argument is set.
    TFcs.||_|_d|_t�j|fd|i|��dS)N�beat)�enabledrbr-r.)rrrbr0r1rrr.�sz
Beat.__init__cCs@ddlm}|jj�d�r"tt��||j|j|j	d�}|_
|S)Nr)�EmbeddedService)rr)�schedule_filenameZ
scheduler_cls)Zcelery.beatrdrr(�endswithr
�ERR_B_GREENr=reZ	schedulerrb)rrrd�brrrr �s�zBeat.create)F)	r'r(r)r*�labelZconditionalr.r rCrrr1rr�s
rcs(eZdZdZ�fdd�Zdd�Z�ZS)rz:Bootstep that sets up between-restart state database file.cs&|j|_d|_t�j|fi|��dSr+)�statedbrc�_persistencer-r.r/r1rrr.�szStateDB.__init__cCs,|j�|j|j|jj�|_t�|jj�dSr+)	�stateZ
Persistentrjr=r>rk�atexit�register�saverrrrr �szStateDB.create)r'r(r)r*r.r rCrrr1rr�src@seZdZdZdZdd�ZdS)rz)Bootstep starting the Consumer blueprint.TcCsn|jrt|jd�|j}n|j|j}|j|j|j|j|j|j	||j
|j|j||j
|j|j|jd�}|_|S)N�)r_�task_eventsZ
init_callbackZinitial_prefetch_countr<rr=�
controllerr,Zworker_options�disable_rate_limits�prefetch_multiplier)rE�maxrtrFrZconsumer_clsr\r_rqZready_callbackr<rr=r,�optionsrsZconsumer)rrZprefetch_count�crrrr �s&�zConsumer.createN)r'r(r)r*�lastr rrrrr�sr)#r*rmrXZkombu.asynchronousrr5rrZkombu.asynchronous.semaphorerrZkombu.asynchronous.timerrrZceleryrZ
celery._stater	Zcelery.exceptionsr
Zcelery.platformsrZcelery.utils.logrr"�__all__rWrgr[ZStepZ
StartStopStepr
rrrrrrr�<module>s**P