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

X>h�/�@s&dZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZm
Z
dd	lmZmZdd
lmZzddlmZWney�dZYn0efZd
ZdZdZdZee�Zdd�Zdd�ZGdd�de
�ZGdd�d�Z Gdd�de!�Z"Gdd�de"d�Z#Gdd�de#�Z$Gdd �d e$�Z%d!S)"z0A directed acyclic graph of reusable components.�)�deque)�Event)�
ignore_errors)�bytes_to_str��symbol_by_name�)�DependencyGraph�GraphFormatter)�instantiate�qualname)�
get_logger)�GreenletExit�)�	Blueprint�Step�
StartStopStep�ConsumerStep��cCsd|j�d|��S)Nz| z: ��alias)�ns�fmtrr�:/usr/local/lib/python3.9/site-packages/celery/bootsteps.py�_presrcCs|j�dd�dS)N�.r���)�name�rsplit)�srrr�_label#sr!c@sDeZdZdZdZdZdddd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�
StepFormatterz'Graph formatter for :class:`Blueprint`.u⧉u∘Z
parallelogramZ
slategray4Z
slategray3)�shape�colorZ	fillcolorcCs,|o*d�|�|�t|jpt|��dd���S)Nz{}{}zutf-8�ignore)�format�_get_prefixr�labelr!�encode��self�steprrrr(2s��zStepFormatter.labelcCs|jr|jS|jr|jSdS)N�)�last�blueprint_prefix�conditional�conditional_prefixr*rrrr'9s
zStepFormatter._get_prefixcKs |jr|jn|j}|�|||�S�N)r.�blueprint_schemeZnode_schemeZ	draw_node)r+�obj�attrs�schemerrr�node@szStepFormatter.nodecKs&|jr|jddd�|�|||j|�S)N�noneZ
darkseagreen3)Z	arrowheadr$)r.�updateZ	draw_edgeZedge_scheme)r+�a�br5rrr�edgeDszStepFormatter.edgeN)�__name__�
__module__�__qualname__�__doc__r/r1r3r(r'r7r<rrrrr"'s�r"c@s�eZdZdZeZdZdZdZe	�Z
ddedede
diZd3dd	�Zd
d�Zdd
�Zdd�Zdd�Zd4dd�Zd5dd�Zd6dd�Zd7dd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Z e!d1d2��Z"dS)8ra�Blueprint containing bootsteps that can be applied to objects.

    Arguments:
        steps Sequence[Union[str, Step]]: List of steps.
        name (str): Set explicit name for this blueprint.
        on_start (Callable): Optional callback applied after blueprint start.
        on_close (Callable): Optional callback applied before blueprint close.
        on_stopped (Callable): Optional callback applied after
            blueprint stopped.
    NrZinitializing�running�closing�terminatingcCsT|p|jptt|��|_t|p g�t|j�B|_||_||_||_t	�|_
i|_dSr2)rr�type�set�
default_steps�types�on_start�on_close�
on_stoppedr�shutdown_complete�steps)r+rLrrHrIrJrrr�__init__cszBlueprint.__init__cCsbt|_|jr|��tdd�|jD��D]4\}}|�d|j�|d|_|�|�t	�
d�q(dS)Ncss|]}|dur|VqdSr2r��.0r rrr�	<genexpr>q�z"Blueprint.start.<locals>.<genexpr>zStarting %srz^-- substep ok)�RUN�staterH�	enumeraterL�_debugr�started�start�logger�debug)r+�parent�ir,rrrrWms

zBlueprint.startcCs|j|jpdS�Nr)�
state_to_namerS�r+rrr�human_statewszBlueprint.human_statecCs(i}|jD]}|�|�|�pi�q
|Sr2)rLr9�info)r+rZr`r,rrrr`zs
zBlueprint.infocCs$|jr|��|j|dddd�dS)N�closerBF)�reverse)rI�send_all�r+rZrrrra�szBlueprint.close�stop�
restartingFcCs|j||||d�dS)N)�	propagate)rc)r+rZ�method�descriptionrgrrr�restart�szBlueprint.restartTrcCs�|p|�dd�}|rt|j�n|j}|D]�}|r(t||d�}	|	dur(|�d|��|j�z|	|g|�R�Wq(ty�}
z$|r��t�	d||j|
�WYd}
~
q(d}
~
00q(dS)N�_� z%s %s...zError on %s %s: %r)
�replace�reversedrL�getattrrU�
capitalizer�	ExceptionrX�	exception)r+rZrhrirbrg�argsrLr,Zfun�excrrrrc�s"
�
�zBlueprint.send_allcCs�|rdnd}|jttfvrdS|jtks8|jt|j�krLt|_|j��dS|�	|�t|_|j
||rjdnd|dd�|jr�|��t|_|j��dS)NrCZstopping�	terminatereF)rirg)rS�CLOSE�	TERMINATErRrV�lenrLrKrErarjrJ)r+rZraru�whatrrrre�s"

�zBlueprint.stopcCs*z|jj|d�Wnty$Yn0dS)N)�timeout)rK�wait�
IGNORE_ERRORS)r+rzrrr�join�szBlueprint.joincKs�|�d�g}|_|��}|_|�d�|�|�D](}||fi|��}|||j<|�|�q6|�dd�dd�|jD���|D]}|�|�q�|S)arApply the steps in this blueprint to an object.

        This will apply the ``__init__`` and ``include`` methods
        of each step, with the object as argument::

            step = Step(obj)
            ...
            step.include(obj)

        For :class:`StartStopStep` the services created
        will also be added to the objects ``steps`` attribute.
        zPreparing bootsteps.zBuilding graph...zNew boot order: {%s}z, css|]}|jVqdSr2rrNrrrrP�rQz"Blueprint.apply.<locals>.<genexpr>)	rU�order�claim_stepsrL�_finalize_stepsr�appendr}�include)r+rZ�kwargsr~rL�Sr,rrr�apply�s



�zBlueprint.applycCs8|jj�|jj�|j�t|jd�t|jd��dS)Nrr)�graph�adjacentr9�add_edgerDr~)r+�otherrrr�connect_with�szBlueprint.connect_withcCs
|j|Sr2)rL)r+rrrr�__getitem__�szBlueprint.__getitem__cCstdd�|j��D�d�S)Ncss|]}|jr|VqdSr2)r.�rO�CrrrrP�rQz'Blueprint._find_last.<locals>.<genexpr>)�nextrL�valuesr^rrr�
_find_last�szBlueprint._find_lastcCsx|��D]}dd�|jD�|_qtdd�|��D��}|rt|��D].}t|�}|j|jvrd|||j<|�|j�qBq6dS)NcSsg|]}t|��qSrr)rO�deprrr�
<listcomp>�rQz(Blueprint._firstpass.<locals>.<listcomp>css|]}|jVqdSr2��requires�rOr,rrrrP�rQz'Blueprint._firstpass.<locals>.<genexpr>)r�r�r�popleftrrrLr�)r+rLr,�streamr7rrr�
_firstpass�s
zBlueprint._firstpassc
Cs�|��}|�|�dd�|��D�}t||j|d�d�}|_|r`|D]}||krF|�||�qFz
|��WSty�}ztd|��WYd}~n
d}~00dS)Ncss|]}||jfVqdSr2r�r�rrrrP�rQz,Blueprint._finalize_steps.<locals>.<genexpr>)�root)�	formatterzunknown bootstep: %s)	r�r�r�r	r
r�r�Ztopsort�KeyError)r+rLr.�it�Gr4rtrrrr��s
�
zBlueprint._finalize_stepscst�fdd��jD��S)Nc3s|]}��|�VqdSr2)�	load_stepr�r^rrrP�rQz(Blueprint.claim_steps.<locals>.<genexpr>)�dictrGr^rr^rr�szBlueprint.claim_stepscCst|�}|j|fSr2)rrr*rrrr��szBlueprint.load_stepcGstjt||�g|�R�Sr2)rXrYr)r+�msgrsrrrrUszBlueprint._debugcCst|�Sr2)r!r^rrrrszBlueprint.alias)NNNNN)rerfF)NTTr)TF)N)#r=r>r?r@r"r
rrSrVrErFrRrvrwr]rMrWr_r`rarjrcrer}r�r�r�r�r�r�rr�rU�propertyrrrrrrJsH��


�
�


rcs8eZdZdZdZdZ�fdd�Zdd�Zdd�Z�Z	S)	�StepTypezMeta-class for steps.NcsJ|�d�}|r|�d|��n|}|j||�d�p2|d�t��||||�S)Nr>rr)r?r)�getr9�super�__new__)�clsr�basesr5�module�qname��	__class__rrr�s
�zStepType.__new__cCs|jSr2)r�r�rrr�__str__szStepType.__str__cCs
d�|�S)Nzstep:{0.name}{{{0.requires!r}}})r&r�rrr�__repr__szStepType.__repr__)
r=r>r?r@rr�r�r�r��
__classcell__rrr�rr�
s	r�c@steZdZdZdZdZdZdZdZdZ	dd�Z
dd	�Zd
d�Zdd
�Z
dd�Zdd�Zdd�Zedd��Zdd�ZdS)rz�A Bootstep.

    The :meth:`__init__` method is called when the step
    is bound to a parent object, and can as such be used
    to initialize attributes in the parent object at
    parent instantiation-time.
    NFrTcKsdSr2r)r+rZr�rrrrM?sz
Step.__init__cCs|jS)z�Return true if bootstep should be included.

        You can define this as an optional predicate that decides whether
        this step should be created.
        )�enabledrdrrr�
include_ifBszStep.include_ifcOst|g|�Ri|��Sr2)r)r+rrsr�rrrrJszStep.instantiatecCs|�|�rd|�|�fSdS)NT)FN)r��createrdrrr�_should_includeMs
zStep._should_includecCs|�|�dSr\)r�rdrrrr�RszStep.includecCsdS)zCreate the step.Nrrdrrrr�UszStep.createcCsd|j�d�S)Nz<step: �>rr^rrrr�Xsz
Step.__repr__cCs|jpt|�Sr2)r(r!r^rrrr[sz
Step.aliascCsdSr2r)r+r4rrrr`_sz	Step.info)r=r>r?r@rr(r0r�r.r�rMr�rr�r�r�r�r�rr`rrrrr s"	
r)�	metaclassc@s<eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	dS)
rz3Bootstep that must be started and stopped in order.NcCs|jr|j��SdSr2)r4rWrdrrrrWkszStartStopStep.startcCs|jr|j��SdSr2)r4rerdrrrreoszStartStopStep.stopcCsdSr2rrdrrrrasszStartStopStep.closecCs|jrt|jd|jj��SdS)Nru)r4rorerdrrrruvszStartStopStep.terminatecCs(|�|�\}}|r$||_|j�|�|Sr2)r�r4rLr�)r+rZ�inc�retrrrr�zs
zStartStopStep.include)
r=r>r?r@r4rWrerarur�rrrrrcsrc@sBeZdZdZdZdZdd�Zdd�Zdd	�Zd
d�Z	dd
d�Z
dS)rz(Bootstep that starts a message consumer.)z!celery.worker.consumer:ConnectionNcCstd��dS)Nzmissing get_consumers)�NotImplementedError)r+�channelrrr�
get_consumers�szConsumerStep.get_consumerscCs2|j��}|�|�|_|jpgD]}|��q dSr2)�
connectionr�r��	consumersZconsume)r+�cr��consumerrrrrW�s
zConsumerStep.startcCs|�|d�dS)NT��_close�r+r�rrrre�szConsumerStep.stopcCs|�|d�dS)NFr�r�rrr�shutdown�szConsumerStep.shutdownTcCsVt�}|jpgD](}|r&t|j|j�|jr|�|j�q|D]}t|j|j�q>dSr2)rEr�rr��cancelr��addra)r+r�Zcancel_consumersZchannelsr�r�rrrr��szConsumerStep._close)T)r=r>r?r@r�r�r�rWrer�r�rrrrr�srN)&r@�collectionsr�	threadingrZkombu.commonrZkombu.utils.encodingrZkombu.utils.importsrZutils.graphr	r
Z
utils.importsrrZ	utils.logr
Zgreenletr�ImportErrorr|�__all__rRrvrwr=rXrr!r"rrDr�rrrrrrr�<module>s6
#AC