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__/request.cpython-39.pyc
a

X>h�j�@s�dZddlZddlZddlmZddlmZmZddlmZddlm	Z	ddl
mZddlm
Z
mZdd	lmZdd
lmZmZddlmZddlmZmZmZdd
lmZddlmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ddl%mZ&ddl'm(Z(m)Z)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2m3Z3m4Z4ddl5m6Z6dZ7e8ed�Z9e,e:�Z;e;j<e;j=e;j>e;j?f\Z<Z=Z@Z?daAdaBdd�ZCeC�e4jDZDejEjFZGejHjFZIe6jJZJe6jKZKe6jLZMe6jNZNGdd�d�ZOeeMeKdefdd�ZPdS) zfTask request.

This module defines the :class:`Request` class, that specifies
how tasks are executed.
�N)�datetime)�	monotonic�time)�ref)�TERM_SIGNAME)�ExceptionWithTraceback)�	safe_repr�safe_str)�cached_property)�current_app�signals)�Context)�fast_trace_task�
trace_task�trace_task_ret)�BasePool)�Ignore�InvalidTaskError�Reject�Retry�TaskRevokedError�
Terminated�TimeLimitExceeded�WorkerLostError)r)�maybe�
maybe_list�noop)�
get_logger)�gethostname)�get_pickled_exception)�
maybe_iso8601�maybe_make_aware�timezone�)�state)�Request�pypy_version_infoFcCst�tj�at�tj�adS�N)�logger�isEnabledFor�logging�DEBUG�_does_debug�INFO�
_does_info�r/r/�?/usr/local/lib/python3.9/site-packages/celery/worker/request.py�__optimize__.sr1c@sFeZdZdZdZdZdZdZdZdZ	dZ
dZdZe
s8dZeddddddeddddeefdd�Zed	d
��Zedd��Zed
d��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd ��Zed!d"��Z ed#d$��Z!ed%d&��Z"ed'd(��Z#ed)d*��Z$e$j%d+d*��Z$ed,d-��Z&ed.d/��Z'ed0d1��Z(e(j%d2d1��Z(ed3d4��Z)ed5d6��Z*ed7d8��Z+ed9d:��Z,e,j%d;d:��Z,ed<d=��Z-ed>d?��Z.ed@dA��Z/e/j%dBdA��Z/edCdD��Z0e0j%dEdD��Z0edFdG��Z1edHdI��Z2edJdK��Z3ee4dL�dMdN��Z5ee6dL�dOdP��Z7edQdR��Z8e9dS�dTdU�Z:d�dVdW�Z;dXdY�Z<d�dZd[�Z=d�d\d]�Z>d^d_�Z?d`da�Z@dbdc�ZAddde�ZBdfdg�ZCdhdi�ZDdjdk�ZEdldm�ZFd�dndo�ZGdpdq�ZHd�drds�ZId�dtdu�ZJdvdw�ZKdxdy�ZLdzd{�ZMeNd|d}��ZOeNd~d��ZPeNd�d���ZQeNd�d���ZReNd�d���ZSeNd�d���ZTdS)�r%zA request for task execution.FN)NN)�_app�_type�name�id�_root_id�
_parent_id�_on_ack�_body�	_hostname�_eventer�_connection_errors�_task�_eta�_expires�
_request_dict�
_on_reject�_utc�
_content_type�_content_encoding�	_argsrepr�_kwargsrepr�_args�_kwargs�_decodedZ	__payload�__weakref__�__dict__Tc
Ks�||_|dur|j��n|��|_|
dur0|jn|
|_||_|
|_||_|rZd|_	|_
n|j|j|_	|_
|jrx|jn|j
|_|jd|_|jd|_|_d|jvr�|jdp�|j|_|j�d�|_|j�d�|_|j�dd�}|r�||_|j�dd�|_|j�d	d�|_||_|	|_|�p$t�|_||_|�p6d
|_|�pL|jj|j|_|j�dd�|_ |j�d
�}|du�r�z||�}Wn@t!t"t#f�y�}z t$d|�d|����WYd}~n
d}~00|||j%�|_&nd|_&|j�d�}|du�rNz||�}Wn@t!t"t#f�y<}z t$d|�d|����WYd}~n
d}~00|||j%�|_'nd|_'|j(�p^i}|j)�pji}|�d�|�d�|�d�|�dd�d�|_*|j�+||�d�|�d�|j|j*d��|j\|jd<|jd<}|jd|_,|jd|_-dS)Nr5�taskZshadow�root_id�	parent_id�	timelimit�argsrepr��
kwargsreprr/�
ignore_resultF�etazinvalid ETA value z: �expireszinvalid expires value �exchange�routing_key�priority�redelivered)rVrWrXrY�reply_to�correlation_id)�
propertiesrZr[�hostname�
delivery_info�args�kwargs).�_message�headers�copyr@�bodyr9r2rBrIrCrD�content_type�content_encoding�payload�_Request__payloadr5r3r4�getr6r7�time_limitsrErFr8rArr:r;r<�tasksr=�_ignore_result�AttributeError�
ValueError�	TypeErrorr�tzlocalr>r?r^r\�_delivery_info�updaterGrH)�self�message�on_ackr]�eventer�app�connection_errors�request_dictrL�	on_rejectrdrb�decoded�utcr!r �optsrOrT�excrUr^r\�_r/r/r0�__init__Zs���


�
�
��zRequest.__init__cCs|jSr')rq�rsr/r/r0r^�szRequest.delivery_infocCs|jSr')rar�r/r/r0rt�szRequest.messagecCs|jSr'�r@r�r/r/r0ry�szRequest.request_dictcCs|jSr')r9r�r/r/r0rd�szRequest.bodycCs|jSr')r2r�r/r/r0rw�szRequest.appcCs|jSr')rBr�r/r/r0r|�szRequest.utccCs|jSr')rCr�r/r/r0re�szRequest.content_typecCs|jSr')rDr�r/r/r0rf�szRequest.content_encodingcCs|jSr')r3r�r/r/r0�type�szRequest.typecCs|jSr')r6r�r/r/r0rM�szRequest.root_idcCs|jSr')r7r�r/r/r0rN�szRequest.parent_idcCs|jSr')rEr�r/r/r0rP�szRequest.argsreprcCs|jSr')rGr�r/r/r0r_�szRequest.argscCs|jSr')rHr�r/r/r0r`�szRequest.kwargscCs|jSr')rFr�r/r/r0rR�szRequest.kwargsreprcCs|jSr')r8r�r/r/r0ru�szRequest.on_ackcCs|jSr'�rAr�r/r/r0rz�szRequest.on_rejectcCs
||_dSr'r��rs�valuer/r/r0rz�scCs|jSr')r:r�r/r/r0r]�szRequest.hostnamecCs|jSr')rlr�r/r/r0rS�szRequest.ignore_resultcCs|jSr'�r;r�r/r/r0rv�szRequest.eventercCs
||_dSr'r�)rsrvr/r/r0rvscCs|jSr')r<r�r/r/r0rxszRequest.connection_errorscCs|jSr')r=r�r/r/r0rL
szRequest.taskcCs|jSr')r>r�r/r/r0rTszRequest.etacCs|jSr'�r?r�r/r/r0rUszRequest.expirescCs
||_dSr'r�r�r/r/r0rUscCs|jdur|jjj|_|jSr')�_tzlocalr2�confr"r�r/r/r0rps
zRequest.tzlocalcCs|jjp|jjSr')rLrSZstore_errors_even_if_ignoredr�r/r/r0�store_errors s
�zRequest.store_errorscCs|jSr'�r5r�r/r/r0�task_id%szRequest.task_idcCs
||_dSr'r�r�r/r/r0r�*scCs|jSr'�r4r�r/r/r0�	task_name.szRequest.task_namecCs
||_dSr'r�r�r/r/r0r�3scCs
|jdS)NrZr�r�r/r/r0rZ7szRequest.reply_tocCs|j�dd�S)N�replaced_task_nestingr�r@rir�r/r/r0r�<szRequest.replaced_task_nestingcCs|j�dg�S)N�groupsr�r�r/r/r0r�@szRequest.groups)�returncCs|j�d�pgS)N�stamped_headersr�r�r/r/r0r�DszRequest.stamped_headerscs$|j�d�pi��fdd�|jD�S)N�stampscsi|]}|��|��qSr/)ri)�.0�header�r�r/r0�
<dictcomp>K�z"Request.stamps.<locals>.<dictcomp>)r@rir�r�r/r�r0r�HszRequest.stampscCs
|jdS)Nr[r�r�r/r/r0r[MszRequest.correlation_id)�poolc	Ks�|j}|j}|��rt|��|j\}}|jjr2tnt}|j	||j
||j|j|j
|jf|j|j|j|j|pl|j|pt|j|d�	}tt|�|_|S)aUsed by the worker to send this task to the pool.

        Arguments:
            pool (~celery.concurrency.base.TaskPool): The execution pool
                used to execute this request.

        Raises:
            celery.exceptions.TaskRevokedError: if the task was revoked.
        �r_Zaccept_callbackZtimeout_callback�callbackZerror_callbackZsoft_timeout�timeoutr[)r5r=�revokedrrjr2�use_fast_trace_taskrr�apply_asyncr3r@r9rCrD�on_accepted�
on_timeout�
on_success�
on_failure�soft_time_limit�
time_limitrr�
_apply_result)	rsr�r`r�rLr�r��trace�resultr/r/r0�execute_using_poolRs*

��
zRequest.execute_using_poolc
Cs�|��rdS|jjs|��|j\}}}|j}|j||dd�fi|pFi��t|j|j|j	|j
||j|jj
|jd�\}}}}|r�|jdd�n|��|S)z�Execute the task in a :func:`~celery.app.trace.trace_task`.

        Arguments:
            loglevel (int): The loglevel used by the task.
            logfile (str): The logfile used by the task.
        NF)�loglevel�logfileZis_eager)r]�loaderrw��requeue)r�rL�	acks_late�acknowledge�_payloadr@rrrr5rGrHr:r2r��reject)rsr�r�r�embed�request�retval�Ir/r/r0�executess*��
�zRequest.executecCs2|jr.t�|jj�}||jkr.t�|j�dSdS)z%If expired, mark the task as revoked.TN)rUr�now�tzinfo�
revoked_tasks�addr5)rsr�r/r/r0�maybe_expire�s

zRequest.maybe_expirecCsft�|p
t�}|jr4|�|j|�|�dd|d�n
||f|_|jdurb|��}|durb|�	|�dS)N�
terminatedTF)
�_signals�signumr�
time_start�
terminate_job�
worker_pid�_announce_revoked�_terminate_on_ackr��	terminate�rsr��signal�objr/r/r0r��s

zRequest.terminatecCsRt�|p
t�}|jr*|�|j|�|��|jdurN|��}|durN|�|�dSr')	r�r�rr�r�r��_announce_cancelledr�r�r�r/r/r0�cancel�s
zRequest.cancelcCsnt|�|�d�d}t|d�}|jjj|j||jd�|j�||j|j	|j
d�d|_t|j|jdd�dS)Nztask-cancelledzcancelled by Celery)rt)r�T)r��einfo)
�
task_ready�
send_eventrrL�backendZ
mark_as_retryr5�_context�on_retryr_r`�_already_cancelled�
send_retry)rs�reasonr~r/r/r0r��s

�zRequest._announce_cancelledcCs^t|�|jd|||d�|jjj|j||j|jd�|��d|_	t
|j|j|||d�dS)Nztask-revoked)r�r��expired�r�Zstore_resultT)r�r�r�r�)r�r�rLr�Zmark_as_revokedr5r�r�r��_already_revoked�send_revoked)rsr�r�r�r�r/r/r0r��s�
�
�zRequest._announce_revokedc
Csd}|jrdS|jr|��}|jtv}d\}}|s�|jr�|jD]~}|tvr>t|}|jjd|}t	|t
tf�r�|D] }|t|�vrtd}||i}q�qtn t
|t|�v||kg�}||i}q�q>t
|||f��rd}	|r�|	d|7}	t|	|j|j�|�|r�dnddd	|�dSdS)
z%If revoked, skip task and mark state.FT)FNr�zDiscarding revoked task: %s[%s]z (revoked by header: %s)r�r�N)r�rUr�r5r�r��revoked_stampsrarb�
isinstance�list�tupler�any�infor4r�)
rsr�Z
revoked_by_idZrevoked_by_headerZrevoking_headerZstampZrevoked_headerZstamped_headerZ
stamped_valueZlog_msgr/r/r0r��sD



��zRequest.revokedcKs4|jr0|jjr0|jjr0|jj|fd|ji|��dS)N�uuid)r;�enabledrLZsend_events�sendr5)rsr��fieldsr/r/r0r��szRequest.send_eventcCsj||_t�t�||_t|�|jjs0|��|�d�t	rPt
d|j|j|�|j
durf|j|j
�dS)z4Handler called when task is accepted by worker pool.ztask-startedzTask accepted: %s[%s] pid:%rN)r�rrr��
task_acceptedrLr�r�r�r,�debugr4r5r�r�)rs�pidZ
time_acceptedr/r/r0r��s

zRequest.on_acceptedcCsr|rtd||j|j�nVt|�td||j|j�t|�}|jjj|j||j	|j
d�|jjrn|jjrn|�
�dS)z%Handler called if the task times out.z)Soft time limit (%ss) exceeded for %s[%s]z)Hard time limit (%ss) exceeded for %s[%s]r�N)�warnr4r5r��errorrrLr��mark_as_failurer�r�r��acks_on_failure_or_timeoutr�)rsZsoftr�r~r/r/r0r�	s
�
�
�zRequest.on_timeoutcKst|\}}}|rD|j}t|t�r$|j}t|ttf�r6|�|j|dd�St|dd�|jj	r`|�
�|jd||d�dS)z6Handler called if the task was successfully processed.T��	return_ok�Z
successful�task-succeeded�r��runtimeN)�	exceptionr�rr~�
SystemExit�KeyboardInterruptr�r�rLr�r�r��rsZfailed__retval__runtimer`�failedr�r�r~r/r/r0r�s

zRequest.on_successcCs2|jjr|��|jdt|jj�t|j�d�dS)z-Handler called if the task should be retried.ztask-retried�r��	tracebackN)	rLr�r�r�rr�r~r	r�)rs�exc_infor/r/r0r�-s
�zRequest.on_retryc
	Cs�t|�|j}t|t�r|j}t|t�}|rP|jsL|jsL|�ddt	|�d�dSt|t
�rjt
d|����n>t|t�r�|j|j
d�St|t�r�|��St|t�r�|�|�Sd}t|t�}|jj�r |jjr�|p�t|t�o�|jj}|jj}	|�rd}|j|d�d}n|	�r|��n|jdd�|�sr|�s2|�sr|jjj|j||j|jd�tjj|j|j||j |j!|j"|d�|�r�|j#d	t$t%|j��|j"d
�|�s�t&d||j'd�dS)
z/Handler called if the task raised an exception.r�TFNz
Process got: r�r�)Zsenderr�r�r_r`r�r�ztask-failedr�zTask handler raised error: %r)r�)(r�r�r�rr~rr�r�r��str�MemoryErrorrr�r�rr�rr�rrLr�Zreject_on_worker_lostrr�r�r�r5r�r�rZtask_failurer�r_r`r�r�rrr�r�)
rsr�Zsend_failed_eventr�r~Z
is_terminatedr�Zis_worker_lostr�Zackr/r/r0r�6sl


�






�

����zRequest.on_failurecCs|js|�t|j�d|_dS)zAcknowledge task.TN)�acknowledgedr8r(r<r�r/r/r0r��szRequest.acknowledgecCs.|js*|�t|j|�d|_|jd|d�dS)NTz
task-rejectedr�)r�rAr(r<r�)rsr�r/r/r0r��szRequest.rejectcCsB|j|j|s|jn|j|s |jn|j|j|j|j|j	|j
|jd�
S)N)
r5r4r_r`r�r]r�r�r^r�)r5r4rGrErHrFr3r:r�r�r^r�)rs�safer/r/r0r��s�zRequest.infocCs
d�|�S)Nz{0.name}[{0.id}])�formatr�r/r/r0�	humaninfo�szRequest.humaninfocCs@d�|��|jrd|j�d�nd|jr4d|j�d�ndg���S)z``str(self)``.� z ETA:[�]rQz
 expires:[)�joinr�r>r?�stripr�r/r/r0�__str__�s
�zRequest.__str__cCsd�t|�j|��|j|j�S)z``repr(self)``.z<{}: {} {} {}>)r�r��__name__r�rErFr�r/r/r0�__repr__�s�zRequest.__repr__cCs|jSr')rhr�r/r/r0r��szRequest._payloadcCs|j\}}}|�d�S)N�chord�r�ri�rsrr�r/r/r0r�sz
Request.chordcCs|j\}}}|�d�S)N�errbacksrrr/r/r0r	�szRequest.errbackscCs|j�d�S)N�groupr�r�r/r/r0r
�sz
Request.groupcCs.|j}|j\}}}|jfi|p i��t|�S)z9Context (:class:`~celery.app.task.Context`) of this task.)r@r�rrr
)rsr�rr�r/r/r0r��szRequest._contextcCs|j�d�S)N�group_indexr�r�r/r/r0r�szRequest.group_index)NN)N)N)TF)F)F)Ur�
__module__�__qualname__�__doc__r�r�r�rjr�r�r�r�r��IS_PYPY�	__slots__rr!r r��propertyr^rtryrdrwr|rerfr�rMrNrPr_r`rRrurz�setterr]rSrvrxrLrTrUrpr�r�r�rZr�r�r�r��dictr�r[rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr
r�rr	r
r�rr/r/r/r0r%Cs	�
T




































!
"



)	
P






	r%c
	s^|j�|j�|j�|j�|o |j��dur8|	jr4tnt�G��������fdd�d|�}
|
S)Ncs0eZdZ�����fdd�Z���fdd�ZdS)z#create_request_cls.<locals>.Requestcsp|j}|��rt|��|j\}}��|j||j|j|j|jf|j	|j
|j|j|pR�|pX�|d�	}t
�|�|_|S)Nr�)r�r�rrjr�ryrdrerfr�r�r�r�rr�)rsr�r`r�r�r�r�)r��default_soft_time_limit�default_time_limitrr�r/r0r��s&
��z6create_request_cls.<locals>.Request.execute_using_poolcst|\}}}|rD|j}t|t�r$|j}t|ttf�r6|�|j|dd�S�|dd��r\|���rp|jd||d�dS)NTr�r�r�r�)	r�r�rr~r�r�r�r�r�r�)r��eventsr�r/r0r�s

�z.create_request_cls.<locals>.Request.on_successN)rrr
r�r�r/�r�r�rrrrr�r�r/r0r%�sr%)r�r�r�r�r�r�rr)�baserLr�r]rvrr�r�r�rwr%r/rr0�create_request_cls�s
",r)Qrr*�sysrrr�weakrefrZbilliard.commonrZbilliard.einforZkombu.utils.encodingrr	Zkombu.utils.objectsr
ZceleryrrZcelery.app.taskr
Zcelery.app.tracerrrZcelery.concurrency.baserZcelery.exceptionsrrrrrrrrZcelery.platformsr�Zcelery.utils.functionalrrrZcelery.utils.logrZcelery.utils.nodenamesrZcelery.utils.serializationrZcelery.utils.timer r!r"rQr$�__all__�hasattrrrr(r�r��warningr�r�r.r,r1Ztz_or_localZtask_revokedr�r�Z
task_retryr�r�r�r�r�r�r%rr/r/r/r0�<module>s^(
�!�