
    h~#                        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dHd	Z G d
 de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      ZeZ G d de      Z G d de      Z G d  d!e      Z G d" d#e      Z G d$ d%e      Z  G d& d'e!e       Z" G d( d)e       Z# G d* d+e!e       Z$ G d, d-e       Z% G d. d/e       Z& G d0 d1e       Z' G d2 d3e       Z( G d4 d5e       Z) G d6 d7e       Z* G d8 d9e+      Z, G d: d;e-      Z. G d< d=e/      Z0e0Z1 G d> d?e/      Z2 G d@ dAe      Z3 G dB dCe3      Z4 G dD dEe3      Z5 G dF dGe      Z6y)Ia  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                 D    |j                   |ur|j                  |      |)zReraise exception.)__traceback__with_traceback)tpvaluetbs      M/var/www/Befach/backend/env/lib/python3.12/site-packages/celery/exceptions.pyr	   r	   j   s&    "$""2&&
K    c                       e Zd ZdZy)r
   z#Base class for all Celery warnings.N__name__
__module____qualname____doc__ r1   r0   r
   r
   q   s    -r1   r
   c                       e Zd ZdZy)r   z6send_task ignores :setting:`task_always_eager` option.Nr3   r8   r1   r0   r   r   u   s    @r1   r   c                       e Zd ZdZy)r   z-Multiple workers are using the same nodename.Nr3   r8   r1   r0   r   r   y       7r1   r   c                       e Zd ZdZy)r   zFixup related warning.Nr3   r8   r1   r0   r   r   }   s     r1   r   c                       e Zd ZdZy)r   zBCelery hasn't been configured, as no config module has been found.Nr3   r8   r1   r0   r   r      s    Lr1   r   c                       e Zd ZdZy)r   zPotential security issue found.Nr3   r8   r1   r0   r   r          )r1   r   c                       e Zd ZdZy)r   z!Base class for all Celery errors.Nr3   r8   r1   r0   r   r      s    +r1   r   c                       e Zd ZdZy)r   z,Base class for task-related semi-predicates.Nr3   r8   r1   r0   r   r      s    6r1   r   c                   F     e Zd ZdZdZdZdZ	 	 d fd	Zd Zd Z	d Z
 xZS )r   z The task is to be retried later.Nc                     ddl m} || _        t        |t              rd |c| _        | _        n"t        |      |r ||      nd c| _        | _        || _        || _	        || _
        t        | 0  | ||fi | y )Nr   )	safe_repr)kombu.utils.encodingrD   message
isinstancestrexcexcsr)   whenis_eagersigsuper__init__)	selfrF   rI   rK   rL   rM   kwargsrD   	__class__s	           r0   rO   zRetry.__init__   sq    2c3"&DHdi":3"?SV3\`DHdi	 sD3F3r1   c                     t        | j                  t        j                        rd| j                   dS d| j                   S )Nzin szat )rG   rK   numbersNumberrP   s    r0   humanizezRetry.humanize   s8    dii01%%TYYK  r1   c                     | j                   r| j                   S | j                  r d| j                          d| j                   S d| j                          S )NzRetry : )rF   rJ   rX   rW   s    r0   __str__zRetry.__str__   sL    <<<<99DMMO,Btyyk::())r1   c                 `    | j                   | j                  | j                  | j                  ffS N)rR   rF   rI   rK   rW   s    r0   
__reduce__zRetry.__reduce__   s$    ~~dhh		BBBr1   )NNNFN)r4   r5   r6   r7   rF   rI   rK   rO   rX   r[   r^   __classcell__rR   s   @r0   r   r      s6    * G C DCH4!
*Cr1   r   c                       e Zd ZdZy)r   z4A task can raise this to ignore doing state updates.Nr3   r8   r1   r0   r   r      s    >r1   r   c                   *     e Zd ZdZd fd	Zd Z xZS )r   zAA task can raise this if it wants to reject/re-queue the message.c                 B    || _         || _        t        |   ||       y r]   )reasonrequeuerN   rO   )rP   rd   re   rR   s      r0   rO   zReject.__init__   s     )r1   c                 :    d| j                    d| j                   S )Nzreject requeue=rZ   )re   rd   rW   s    r0   __repr__zReject.__repr__   s     b>>r1   )NFr4   r5   r6   r7   rO   rg   r_   r`   s   @r0   r   r      s    K*
?r1   r   c                       e Zd ZdZy)r   z(Celery is somehow improperly configured.Nr3   r8   r1   r0   r   r      s    2r1   r   c                       e Zd ZdZy)r   zSecurity related exception.Nr3   r8   r1   r0   r   r      s    %r1   r   c                       e Zd ZdZy)r   zTask related errors.Nr3   r8   r1   r0   r   r      s    r1   r   c                       e Zd ZdZy)r   z.Task routed to a queue not in ``conf.queues``.Nr3   r8   r1   r0   r   r      s    8r1   r   c                       e Zd ZdZy)r   z?Found the end of a stream of data, but the data isn't complete.Nr3   r8   r1   r0   r   r      s    Ir1   r   c                       e Zd ZdZd Zy)r   zThe task is not registered.c                 ,    t         j                  |       S r]   )UNREGISTERED_FMTformatrW   s    r0   rg   zNotRegistered.__repr__   s    &&t,,r1   N)r4   r5   r6   r7   rg   r8   r1   r0   r   r      s
    %-r1   r   c                       e Zd ZdZy)r   zThe task is already registered.Nr3   r8   r1   r0   r   r      r?   r1   r   c                       e Zd ZdZy)r   zThe operation timed out.Nr3   r8   r1   r0   r   r      s    "r1   r   c                   "     e Zd ZdZ fdZ xZS )r   z.The tasks max restart limit has been exceeded.c                     |j                  dg       | _        |j                  dt                     | _        t	        |   |i | y )N	task_argstask_kwargs)poprv   dictrw   rN   rO   )rP   argsrQ   rR   s      r0   rO   z MaxRetriesExceededError.__init__   s<    K4!::mTV<$)&)r1   r4   r5   r6   r7   rO   r_   r`   s   @r0   r   r      s    8* *r1   r   c                       e Zd ZdZy)r   z2The task has been revoked, so no result available.Nr3   r8   r1   r0   r   r      s    <r1   r   c                       e Zd ZdZy)r   z8The task has invalid data or ain't properly constructed.Nr3   r8   r1   r0   r   r      s    Br1   r   c                       e Zd ZdZy)r    z-A task part of the chord raised an exception.Nr3   r8   r1   r0   r    r      r;   r1   r    c                       e Zd ZdZy)r$   zWarning of pending deprecation.Nr3   r8   r1   r0   r$   r$     r?   r1   r$   c                       e Zd ZdZy)r%   zWarning of deprecation.Nr3   r8   r1   r0   r%   r%     s    !r1   r%   c                       e Zd ZdZy)r'   z5Signals that the worker should terminate immediately.Nr3   r8   r1   r0   r'   r'     s    ?r1   r'   c                       e Zd ZdZy)r&   z7Signals that the worker should perform a warm shutdown.Nr3   r8   r1   r0   r&   r&     s    Ar1   r&   c                       e Zd ZdZy)r!   z0An issue writing or reading to/from the backend.Nr3   r8   r1   r0   r!   r!     s    :r1   r!   c                   (     e Zd ZdZd Z fdZ xZS )r"   z"An issue reading from the backend.c                 2    |j                  dd      | _        y )Ntask_id )getr   rP   rz   rQ   s      r0   rO   zBackendGetMetaError.__init__!  s    zz)R0r1   c                 @    t         |          dz   | j                  z   S )N	 task_id:)rN   rg   r   rP   rR   s    r0   rg   zBackendGetMetaError.__repr__$  s    w!K/$,,>>r1   rh   r`   s   @r0   r"   r"     s    ,1? ?r1   r"   c                   (     e Zd ZdZd Z fdZ xZS )r#   z An issue writing to the backend.c                 `    |j                  dd      | _        |j                  dd      | _        y )Nstater   r   )r   r   r   r   s      r0   rO   zBackendStoreError.__init__+  s&    ZZ,
zz)R0r1   c                 `    t         |          dz   | j                  z   dz   | j                  z   S )Nz state:r   )rN   rg   r   r   r   s    r0   rg   zBackendStoreError.__repr__/  s-    w!I-

:[H4<<WWr1   rh   r`   s   @r0   r#   r#   (  s    *1X Xr1   r#   c                   "     e Zd ZdZ fdZ xZS )r(   z6A general command exception which stores an exit code.c                 4    t         |   |       || _        y )N)rF   )rN   rO   	exit_code)rP   rF   r   rR   s      r0   rO   zCeleryCommandException.__init__6  s    )"r1   r{   r`   s   @r0   r(   r(   3  s    @# #r1   r(   r]   )7r7   rU   billiard.exceptionsr   r   r   r   clickr   kombu.exceptionsr   __all__celery.utils.serializationr)   rp   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(   r8   r1   r0   <module>r      s  3j  e e   -%N @ 
.K .A A8} 8!= !MM M*m *,) ,7K 7'CM 'CT ?] ?	?] 	?3; 3&K & 9Hi 9Jy J-Hi -*	 *
#9 #*i *=y =Cy C8 8*!: *", "@j @ "BZ B;9 ;?, ?X X#^ #r1   