o
    ›¨Êh~#  ã                   @   sZ  d Z ddlZddlmZmZmZmZ ddlmZ ddl	m
Z
 dZddlmZ dZdId	d
„ZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZeZG dd„ deƒZG dd „ d eƒZG d!d"„ d"eƒZG d#d$„ d$eƒZG d%d&„ d&eƒZ G d'd(„ d(e!e ƒZ"G d)d*„ d*e ƒZ#G d+d,„ d,e!e ƒZ$G d-d.„ d.e ƒZ%G d/d0„ d0e ƒZ&G d1d2„ d2e ƒZ'G d3d4„ d4e ƒZ(G d5d6„ d6e ƒZ)G d7d8„ d8e ƒZ*G d9d:„ d:e+ƒZ,G d;d<„ d<e-ƒZ.G d=d>„ d>e/ƒZ0e0Z1G d?d@„ d@e/ƒZ2G dAdB„ dBeƒZ3G dCdD„ dDe3ƒZ4G dEdF„ dFe3ƒZ5G dGdH„ dHeƒZ6dS )JaË  Celery error types.

Error Hierarchy
===============

- :exc:`Exception`
    - :exc:`celery.exceptions.CeleryError`
        - :exc:`~celery.exceptions.ImproperlyConfigured`
        - :exc:`~celery.exceptions.SecurityError`
        - :exc:`~celery.exceptions.TaskPredicate`
            - :exc:`~celery.exceptions.Ignore`
            - :exc:`~celery.exceptions.Reject`
            - :exc:`~celery.exceptions.Retry`
        - :exc:`~celery.exceptions.TaskError`
            - :exc:`~celery.exceptions.QueueNotFound`
            - :exc:`~celery.exceptions.IncompleteStream`
            - :exc:`~celery.exceptions.NotRegistered`
            - :exc:`~celery.exceptions.AlreadyRegistered`
            - :exc:`~celery.exceptions.TimeoutError`
            - :exc:`~celery.exceptions.MaxRetriesExceededError`
            - :exc:`~celery.exceptions.TaskRevokedError`
            - :exc:`~celery.exceptions.InvalidTaskError`
            - :exc:`~celery.exceptions.ChordError`
        - :exc:`~celery.exceptions.BackendError`
            - :exc:`~celery.exceptions.BackendGetMetaError`
            - :exc:`~celery.exceptions.BackendStoreError`
    - :class:`kombu.exceptions.KombuError`
        - :exc:`~celery.exceptions.OperationalError`

            Raised when a transport connection error occurs while
            sending a message (be it a task, remote control command error).

            .. note::
                This exception does not inherit from
                :exc:`~celery.exceptions.CeleryError`.
    - **billiard errors** (prefork pool)
        - :exc:`~celery.exceptions.SoftTimeLimitExceeded`
        - :exc:`~celery.exceptions.TimeLimitExceeded`
        - :exc:`~celery.exceptions.WorkerLostError`
        - :exc:`~celery.exceptions.Terminated`
- :class:`UserWarning`
    - :class:`~celery.exceptions.CeleryWarning`
        - :class:`~celery.exceptions.AlwaysEagerIgnored`
        - :class:`~celery.exceptions.DuplicateNodenameWarning`
        - :class:`~celery.exceptions.FixupWarning`
        - :class:`~celery.exceptions.NotConfigured`
        - :class:`~celery.exceptions.SecurityWarning`
- :exc:`BaseException`
    - :exc:`SystemExit`
        - :exc:`~celery.exceptions.WorkerTerminate`
        - :exc:`~celery.exceptions.WorkerShutdown`
é    N)ÚSoftTimeLimitExceededÚ
TerminatedÚTimeLimitExceededÚWorkerLostError)ÚClickException)ÚOperationalError)%ÚreraiseÚCeleryWarningÚAlwaysEagerIgnoredÚDuplicateNodenameWarningÚFixupWarningÚNotConfiguredÚSecurityWarningÚCeleryErrorÚImproperlyConfiguredÚSecurityErrorr   ÚTaskPredicateÚIgnoreÚRejectÚRetryÚ	TaskErrorÚQueueNotFoundÚIncompleteStreamÚNotRegisteredÚAlreadyRegisteredÚTimeoutErrorÚMaxRetriesExceededErrorÚTaskRevokedErrorÚInvalidTaskErrorÚ
ChordErrorÚBackendErrorÚBackendGetMetaErrorÚBackendStoreErrorr   r   r   r   ÚCPendingDeprecationWarningÚCDeprecationWarningÚWorkerShutdownÚWorkerTerminateÚCeleryCommandException)Úget_pickleable_exceptionzBTask of kind {0} never registered, please make sure it's imported.c                 C   s   |j |ur
| |¡‚|‚)zReraise exception.)Ú__traceback__Úwith_traceback)ÚtpÚvalueÚtb© r.   úC/var/www/html/env/lib/python3.10/site-packages/celery/exceptions.pyr   j   s   

r   c                   @   ó   e Zd ZdZdS )r	   z#Base class for all Celery warnings.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r.   r.   r.   r/   r	   q   ó    r	   c                   @   r0   )r
   z6send_task ignores :setting:`task_always_eager` option.Nr1   r.   r.   r.   r/   r
   u   r6   r
   c                   @   r0   )r   z-Multiple workers are using the same nodename.Nr1   r.   r.   r.   r/   r   y   r6   r   c                   @   r0   )r   zFixup related warning.Nr1   r.   r.   r.   r/   r   }   r6   r   c                   @   r0   )r   zBCelery hasn't been configured, as no config module has been found.Nr1   r.   r.   r.   r/   r   �   r6   r   c                   @   r0   )r   zPotential security issue found.Nr1   r.   r.   r.   r/   r   …   r6   r   c                   @   r0   )r   z!Base class for all Celery errors.Nr1   r.   r.   r.   r/   r   ‰   r6   r   c                   @   r0   )r   z,Base class for task-related semi-predicates.Nr1   r.   r.   r.   r/   r   �   r6   r   c                       sJ   e Zd ZdZdZdZdZ		d‡ fdd„	Zdd„ Zdd	„ Z	d
d„ Z
‡  ZS )r   z The task is to be retried later.NFc                    sx   ddl m} || _t|tƒrd || _| _nt|ƒ|r||ƒnd | _| _|| _|| _	|| _
tƒ j| ||fi |¤Ž d S )Nr   )Ú	safe_repr)Úkombu.utils.encodingr7   ÚmessageÚ
isinstanceÚstrÚexcÚexcsr(   ÚwhenÚis_eagerÚsigÚsuperÚ__init__)Úselfr9   r<   r>   r?   r@   Úkwargsr7   ©Ú	__class__r.   r/   rB   ž   s   
zRetry.__init__c                 C   s(   t | jtjƒrd| j› d�S d| j› �S )Nzin Úszat )r:   r>   ÚnumbersÚNumber©rC   r.   r.   r/   Úhumanize«   s   zRetry.humanizec                 C   s6   | j r| j S | jrd|  ¡ › d| j› �S d|  ¡ › �S )NzRetry ú: )r9   r=   rK   rJ   r.   r.   r/   Ú__str__°   s
   zRetry.__str__c                 C   s   | j | j| j| jffS ©N)rF   r9   r<   r>   rJ   r.   r.   r/   Ú
__reduce__·   s   zRetry.__reduce__)NNNFN)r2   r3   r4   r5   r9   r<   r>   rB   rK   rM   rO   Ú__classcell__r.   r.   rE   r/   r   ‘   s    ÿr   c                   @   r0   )r   z4A task can raise this to ignore doing state updates.Nr1   r.   r.   r.   r/   r   ¾   r6   r   c                       s*   e Zd ZdZd‡ fdd„	Zdd„ Z‡  ZS )	r   zAA task can raise this if it wants to reject/re-queue the message.NFc                    s   || _ || _tƒ  ||¡ d S rN   )ÚreasonÚrequeuerA   rB   )rC   rQ   rR   rE   r.   r/   rB   Å   s   zReject.__init__c                 C   s   d| j › d| j› �S )Nzreject requeue=rL   )rR   rQ   rJ   r.   r.   r/   Ú__repr__Ê   ó   zReject.__repr__)NF©r2   r3   r4   r5   rB   rS   rP   r.   r.   rE   r/   r   Â   s    r   c                   @   r0   )r   z(Celery is somehow improperly configured.Nr1   r.   r.   r.   r/   r   Î   r6   r   c                   @   r0   )r   zSecurity related exception.Nr1   r.   r.   r.   r/   r   Ò   r6   r   c                   @   r0   )r   zTask related errors.Nr1   r.   r.   r.   r/   r   Ö   r6   r   c                   @   r0   )r   z.Task routed to a queue not in ``conf.queues``.Nr1   r.   r.   r.   r/   r   Ú   r6   r   c                   @   r0   )r   z?Found the end of a stream of data, but the data isn't complete.Nr1   r.   r.   r.   r/   r   Þ   r6   r   c                   @   s   e Zd ZdZdd„ ZdS )r   zThe task is not registered.c                 C   s
   t  | ¡S rN   )ÚUNREGISTERED_FMTÚformatrJ   r.   r.   r/   rS   å   s   
zNotRegistered.__repr__N)r2   r3   r4   r5   rS   r.   r.   r.   r/   r   â   s    r   c                   @   r0   )r   zThe task is already registered.Nr1   r.   r.   r.   r/   r   é   r6   r   c                   @   r0   )r   zThe operation timed out.Nr1   r.   r.   r.   r/   r   î   r6   r   c                       ó    e Zd ZdZ‡ fdd„Z‡  ZS )r   z.The tasks max restart limit has been exceeded.c                    s4   |  dg ¡| _|  dtƒ ¡| _tƒ j|i |¤Ž d S )NÚ	task_argsÚtask_kwargs)ÚpoprY   ÚdictrZ   rA   rB   ©rC   ÚargsrD   rE   r.   r/   rB   õ   s   z MaxRetriesExceededError.__init__©r2   r3   r4   r5   rB   rP   r.   r.   rE   r/   r   ò   ó    r   c                   @   r0   )r   z2The task has been revoked, so no result available.Nr1   r.   r.   r.   r/   r   û   r6   r   c                   @   r0   )r   z8The task has invalid data or ain't properly constructed.Nr1   r.   r.   r.   r/   r   ÿ   r6   r   c                   @   r0   )r   z-A task part of the chord raised an exception.Nr1   r.   r.   r.   r/   r     r6   r   c                   @   r0   )r#   zWarning of pending deprecation.Nr1   r.   r.   r.   r/   r#     r6   r#   c                   @   r0   )r$   zWarning of deprecation.Nr1   r.   r.   r.   r/   r$     r6   r$   c                   @   r0   )r&   z5Signals that the worker should terminate immediately.Nr1   r.   r.   r.   r/   r&     r6   r&   c                   @   r0   )r%   z7Signals that the worker should perform a warm shutdown.Nr1   r.   r.   r.   r/   r%     r6   r%   c                   @   r0   )r    z0An issue writing or reading to/from the backend.Nr1   r.   r.   r.   r/   r      r6   r    c                       ó(   e Zd ZdZdd„ Z‡ fdd„Z‡  ZS )r!   z"An issue reading from the backend.c                 O   s   |  dd¡| _d S )NÚtask_idÚ )Úgetrb   r]   r.   r.   r/   rB   !  s   zBackendGetMetaError.__init__c                    s   t ƒ  ¡ d | j S )Nú	 task_id:)rA   rS   rb   rJ   rE   r.   r/   rS   $  rT   zBackendGetMetaError.__repr__rU   r.   r.   rE   r/   r!     s    r!   c                       ra   )r"   z An issue writing to the backend.c                 O   s    |  dd¡| _|  dd¡| _d S )NÚstaterc   rb   )rd   rf   rb   r]   r.   r.   r/   rB   +  s   zBackendStoreError.__init__c                    s   t ƒ  ¡ d | j d | j S )Nz state:re   )rA   rS   rf   rb   rJ   rE   r.   r/   rS   /  s   zBackendStoreError.__repr__rU   r.   r.   rE   r/   r"   (  s    r"   c                       rX   )r'   z6A general command exception which stores an exit code.c                    s   t ƒ j|d� || _d S )N)r9   )rA   rB   Ú	exit_code)rC   r9   rg   rE   r.   r/   rB   6  s   
zCeleryCommandException.__init__r_   r.   r.   rE   r/   r'   3  r`   r'   rN   )7r5   rH   Úbilliard.exceptionsr   r   r   r   Úclickr   Úkombu.exceptionsr   Ú__all__Úcelery.utils.serializationr(   rV   r   ÚUserWarningr	   r
   r   r   r   r   Ú	Exceptionr   r   r   ÚRetryTaskErrorr   r   r   r   r   ÚKeyErrorr   r   r   r   r   r   r   r   r   ÚPendingDeprecationWarningr#   ÚDeprecationWarningr$   Ú
SystemExitr&   ÚSystemTerminater%   r    r!   r"   r'   r.   r.   r.   r/   Ú<module>   sT    5'
*	
