o
    wvXj#"  ã                   @   sD  d Z ddlmZm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mZ dZ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eG dd„ deƒƒZeZG dd„ deƒZe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#eG d(d)„ d)e!e ƒƒZ$G d*d+„ d+e ƒZ%G d,d-„ d-e ƒZ&G d.d/„ d/e ƒZ'G d0d1„ d1e ƒZ(G d2d3„ d3e ƒZ)G d4d5„ d5e ƒZ*G d6d7„ d7e+ƒZ,G d8d9„ d9e-ƒZ.G d:d;„ d;e/ƒZ0e0Z1G d<d=„ d=e/ƒZ2G d>d?„ d?eƒZ3G d@dA„ dAe3ƒZ4G dBdC„ dCe3ƒZ5dS )Da•  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`
- :exc:`BaseException`
    - :exc:`SystemExit`
        - :exc:`~celery.exceptions.WorkerTerminate`
        - :exc:`~celery.exceptions.WorkerShutdown`
é    )Úabsolute_importÚunicode_literalsN)ÚSoftTimeLimitExceededÚ
TerminatedÚTimeLimitExceededÚWorkerLostError)ÚOperationalErroré   )Úpython_2_unicode_compatibleÚstring_t)"ÚCeleryWarningÚAlwaysEagerIgnoredÚDuplicateNodenameWarningÚFixupWarningÚNotConfiguredÚ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ÚWorkerTerminatezBTask of kind {0} never registered, please make sure it's imported.c                   @   ó   e Zd ZdZdS )r   z#Base class for all Celery warnings.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r/   r/   úN/var/www/html/myproject/venv/lib/python3.10/site-packages/celery/exceptions.pyr   h   ó    r   c                   @   r)   )r   z6send_task ignores :setting:`task_always_eager` option.Nr*   r/   r/   r/   r0   r   l   r1   r   c                   @   r)   )r   z-Multiple workers are using the same nodename.Nr*   r/   r/   r/   r0   r   p   r1   r   c                   @   r)   )r   zFixup related warning.Nr*   r/   r/   r/   r0   r   t   r1   r   c                   @   r)   )r   zBCelery hasn't been configured, as no config module has been found.Nr*   r/   r/   r/   r0   r   x   r1   r   c                   @   r)   )r   z!Base class for all Celery errors.Nr*   r/   r/   r/   r0   r   |   r1   r   c                   @   r)   )r   z,Base class for task-related semi-predicates.Nr*   r/   r/   r/   r0   r   €   r1   r   c                       sF   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||r||ƒnd | _| _|| _|| _|| _	t
t| ƒj| ||fi |¤Ž d S )Nr   )Ú	safe_repr)Úkombu.utils.encodingr2   ÚmessageÚ
isinstancer   ÚexcÚexcsÚwhenÚis_eagerÚsigÚsuperr   Ú__init__)Úselfr4   r6   r8   r9   r:   Úkwargsr2   ©Ú	__class__r/   r0   r<   ’   s   
 zRetry.__init__c                 C   s"   t | jtjƒrd | ¡S d | ¡S )Nzin {0.when}szat {0.when})r5   r8   ÚnumbersÚNumberÚformat©r=   r/   r/   r0   Úhumanizež   s   

zRetry.humanizec                 C   s2   | j r| j S | jrd |  ¡ | j¡S d |  ¡ ¡S )NzRetry {0}: {1}z	Retry {0})r4   r7   rC   rE   rD   r/   r/   r0   Ú__str__£   s
   zRetry.__str__c                 C   s   | j | j| j| jffS ©N)r@   r4   r7   r8   rD   r/   r/   r0   Ú
__reduce__ª   s   zRetry.__reduce__)NNNFN)r+   r,   r-   r.   r4   r6   r8   r<   rE   rF   rH   Ú__classcell__r/   r/   r?   r0   r   „   s    r   c                   @   r)   )r   z4A task can raise this to ignore doing state updates.Nr*   r/   r/   r/   r0   r   ±   r1   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t| ƒ ||¡ d S rG   )ÚreasonÚrequeuer;   r   r<   )r=   rJ   rK   r?   r/   r0   r<   ¹   s   zReject.__init__c                 C   s   d| j | jf S )Nzreject requeue=%s: %s)rK   rJ   rD   r/   r/   r0   Ú__repr__¾   s   zReject.__repr__)NF©r+   r,   r-   r.   r<   rL   rI   r/   r/   r?   r0   r   µ   s    r   c                   @   r)   )r   z(Celery is somehow improperly configured.Nr*   r/   r/   r/   r0   r   Â   r1   r   c                   @   r)   )r   zSecurity related exception.Nr*   r/   r/   r/   r0   r   Æ   r1   r   c                   @   r)   )r   zTask related errors.Nr*   r/   r/   r/   r0   r   Ê   r1   r   c                   @   r)   )r   z.Task routed to a queue not in ``conf.queues``.Nr*   r/   r/   r/   r0   r   Î   r1   r   c                   @   r)   )r   z?Found the end of a stream of data, but the data isn't complete.Nr*   r/   r/   r/   r0   r   Ò   r1   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 rG   )ÚUNREGISTERED_FMTrC   rD   r/   r/   r0   rL   Ú   s   
zNotRegistered.__repr__N)r+   r,   r-   r.   rL   r/   r/   r/   r0   r   Ö   s    r   c                   @   r)   )r   zThe task is already registered.Nr*   r/   r/   r/   r0   r   Þ   r1   r   c                   @   r)   )r   zThe operation timed out.Nr*   r/   r/   r/   r0   r   ã   r1   r   c                       s    e Zd ZdZ‡ fdd„Z‡  ZS )r   z.The tasks max restart limit has been exceeded.c                    s8   |  dg ¡| _|  dtƒ ¡| _tt| ƒj|i |¤Ž d S )NÚ	task_argsÚtask_kwargs)ÚpoprO   ÚdictrP   r;   r   r<   ©r=   Úargsr>   r?   r/   r0   r<   ê   s   z MaxRetriesExceededError.__init__)r+   r,   r-   r.   r<   rI   r/   r/   r?   r0   r   ç   s    r   c                   @   r)   )r   z2The task has been revoked, so no result available.Nr*   r/   r/   r/   r0   r   ð   r1   r   c                   @   r)   )r    z8The task has invalid data or ain't properly constructed.Nr*   r/   r/   r/   r0   r    ô   r1   r    c                   @   r)   )r!   z-A task part of the chord raised an exception.Nr*   r/   r/   r/   r0   r!   ø   r1   r!   c                   @   r)   )r%   zWarning of pending deprecation.Nr*   r/   r/   r/   r0   r%   ü   r1   r%   c                   @   r)   )r&   zWarning of deprecation.Nr*   r/   r/   r/   r0   r&      r1   r&   c                   @   r)   )r(   z5Signals that the worker should terminate immediately.Nr*   r/   r/   r/   r0   r(     r1   r(   c                   @   r)   )r'   z7Signals that the worker should perform a warm shutdown.Nr*   r/   r/   r/   r0   r'     r1   r'   c                   @   r)   )r"   z0An issue writing or reading to/from the backend.Nr*   r/   r/   r/   r0   r"     r1   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Ú )ÚgetrV   rS   r/   r/   r0   r<     s   zBackendGetMetaError.__init__c                    s   t ƒ  ¡ d | j S )Nú	 task_id:)r;   rL   rV   rD   r?   r/   r0   rL     s   zBackendGetMetaError.__repr__rM   r/   r/   r?   r0   r#     s    r#   c                       rU   )r$   z"An issue writing from the backend.c                 O   s    |  dd¡| _|  dd¡| _d S )NÚstaterW   rV   )rX   rZ   rV   rS   r/   r/   r0   r<      s   zBackendStoreError.__init__c                    s   t ƒ  ¡ d | j d | j S )Nz state:rY   )r;   rL   rZ   rV   rD   r?   r/   r0   rL   $  s   zBackendStoreError.__repr__rM   r/   r/   r?   r0   r$     s    r$   )6r.   Ú
__future__r   r   rA   Úbilliard.exceptionsr   r   r   r   Úkombu.exceptionsr   Úfiver
   r   Ú__all__rN   ÚUserWarningr   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/   r0   Ú<module>   sT   3$)	
