
    %`i                        d dl Z d dlZd dlZd dlmZ d dlmZmZ d dlZd dl	m
c mZ d dlmZ d dlmZmZmZ d dlmZmZmZmZmZmZ d dlmZmZ  e j        e          Ze G d de                       Z!e G d	 d
e!                      Z"e G d de!                      Z#e G d de!                      Z$e G d de!                      Z%e G d de!                      Z&e G d de!                      Z'e G d de'                      Z(e G d de'                      Z)e G d de!                      Z*e G d de!                      Z+e G d de!                      Z,e G d d e!                      Z-e G d! d"e!                      Z.e G d# d$e!                      Z/e G d% d&e!                      Z0e G d' d(e!                      Z1e G d) d*e1                      Z2e G d+ d,e!                      Z3e G d- d.e1e4                      Z5e G d/ d0e1                      Z6e G d1 d2e1                      Z7e G d3 d4e1                      Z8e G d5 d6e1                      Z9e G d7 d8e1                      Z:e G d9 d:e!e;                      Z<e G d; d<e!                      Z=e G d= d>e!                      Z>e G d? d@e!                      Z?e G dA dBe!                      Z@e G dC dDe!                      ZAe G dE dFe!                      ZBe G dG dHe!                      ZCe G dI dJe!                      ZDe G dK dLe!                      ZEe G dM dNe!                      ZF edOP           G dQ dRe*                      ZG edOP           G dS dTeGe;                      ZH edOP           G dU dVe*                      ZI edOP           G dW dXe!                      ZJe G dY dZeKe!                      ZLg e=e!e$e&e'e-e1e2e5e8e9e:e7e<e>e?e@eAeBe%eCe(eDe)eGeHeFeIeJeLe+ZMdS )[    N)format_exception)OptionalUnion)ActorIDTaskIDWorkerID)PYTHONActorDiedErrorContextAddressLanguageNodeDeathInfoRayException)DeveloperAPI	PublicAPIc                   D    e Zd ZdZd Zed             Zed             ZdS )RayErrorz'Super class of all ray exception types.c                     t          |           | | j        f}d                    t          |           }t	          t
          t          j        |           |                                          S )N
)languageserialized_exceptionformatted_exception_string)	type__traceback__joinr   r   r	   pickledumpsSerializeToString)selfexc_infor   s      b/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/exceptions.pyto_byteszRayError.to_bytes   sg    JJd&89%)YY/?/J%K%K"!'d!3!3'A
 
 
 


		    c                 |    t                      }|                    |            t                              |          S N)r   ParseFromStringr   from_ray_exception)bray_exceptions     r    
from_byteszRayError.from_bytes'   s3    $%%a(((**=999r"   c                     | j         t          k    rJ	 t          j        | j                  S # t
          $ r# t          | dd          }t          |          cY S w xY wt          |           S )Nr   z(No formatted exception string available.)	r   r	   r   loadsr   	ExceptiongetattrUnserializableExceptionCrossLanguageError)r(   original_stacktraces     r    r&   zRayError.from_ray_exception-   s    !V++D|M$FGGG 	D 	D 	D '.!0>' '#
 //BCCCCC	D &m444s   + *AAN)__name__
__module____qualname____doc__r!   staticmethodr)   r&    r"   r    r   r      s_        11   : : \:
 5 5 \5 5 5r"   r   c                   "     e Zd ZdZ fdZ xZS )r/   zRaised from another language.c                     t                                          d                    t          j        |j                  |j                             d S )NzAn exception raised from {}:
{})super__init__formatr   Namer   r   )r   r(   	__class__s     r    r:   zCrossLanguageError.__init__D   sR    .55m4558 	
 	
 	
 	
 	
r"   )r1   r2   r3   r4   r:   __classcell__r=   s   @r    r/   r/   @   s>        ''
 
 
 
 
 
 
 
 
r"   r/   c                   D    e Zd ZdZ	 ddee         dee         fdZd ZdS )TaskCancelledErrorzRaised when this task is cancelled.

    Args:
        task_id: The TaskID of the function that was directly
            cancelled.
    Ntask_iderror_messagec                 "    || _         || _        d S r$   )rB   rC   )r   rB   rC   s      r    r:   zTaskCancelledError.__init__V   s     *r"   c                 n    d}| j         rdt          | j                   z   dz   }| j        r
|| j        z  }|S )N zTask: z was cancelled. )rB   strrC   r   msgs     r    __str__zTaskCancelledError.__str__\   sI    < 	DS...1CCC 	&4%%C
r"   )NN)	r1   r2   r3   r4   r   r   rG   r:   rJ   r6   r"   r    rA   rA   M   sf          PT+ +'+?G}+ + + +    r"   rA   c                   H    e Zd ZdZ	 	 	 	 	 d
dZddZddZddZd Zd	 Z	dS )RayTaskErrora  Indicates that a task threw an exception during execution.

    If a task throws an exception during execution, a RayTaskError is stored in
    the object store for each of the task's outputs. When an object is
    retrieved from the object store, the Python method that retrieved it checks
    to see if the object is a RayTaskError and if it is then an exception is
    thrown propagating the error message.
    Nc	                 8   ddl }	|r|| _        n|	j                                        | _        |pt	          j                    | _        |p|	j                                        | _	        || _
        || _        || _        || _        || _        	 t          j        |           nd# t          j        t$          f$ rK}
d| j        j         d|
 d}t(                              |           t-          |          | _        Y d}
~
nd}
~
ww xY w||| j        |||f| _        |J dS )zInitialize a RayTaskError.r   Nz(The original cause of the RayTaskError (z) isn't serializable: z&. Overwriting the cause to a RayError.)ray	proctitle_rayletgetproctitleosgetpidpidutilget_node_ip_addressipfunction_nametraceback_str
actor_repr	_actor_idcauser   r   PicklingError	TypeErrorr=   loggerwarningr   args)r   rX   rY   r\   rO   rT   rW   rZ   actor_idrN   eerr_msgs               r    r:   zRayTaskError.__init__p   sH    	


 	8&DNN [5577DN%")++64466**$!
		+L$i0 	+ 	+ 	+8Z)8 8AB8 8 8 
 NN7###!'**DJJJJJJ	+ #M4:y#rR	(((((s   B   D6AC<<Dreturnc                     t           j        dk    r.t          | j        t                    r|                                 S |                                 S )zMakes a object instance that inherits from both RayTaskError and the type of
        `self.cause`. Raises TypeError if the cause class can't be subclassed)      )sysversion_info
isinstancer\   ExceptionGroup,_make_exceptiongroup_dual_exception_instance$_make_normal_dual_exception_instancer   s    r    make_dual_exception_instancez)RayTaskError.make_dual_exception_instance   sN     w&&:J,
 ,
& DDFFF88:::r"   c                     | j         j        }t          |            G fddt          |          d|j         d}|_        |_         | j                   S )Nc                   0    e Zd Zd Z fdZd ZfdZdS )>RayTaskError._make_normal_dual_exception_instance.<locals>.clsc                 $    || _         |f| _        d S r$   r\   ra   r   r\   s     r    r:   zGRayTaskError._make_normal_dual_exception_instance.<locals>.cls.__init__       "
"H			r"   c                     | j         fS r$   ra   r   clss    r    
__reduce__zIRayTaskError._make_normal_dual_exception_instance.<locals>.cls.__reduce__       TY''r"   c                 ,    t          | j        |          S r$   r-   r\   r   names     r    __getattr__zJRayTaskError._make_normal_dual_exception_instance.<locals>.cls.__getattr__       tz4000r"   c                     S r$   r6   r   	error_msgs    r    rJ   zFRayTaskError._make_normal_dual_exception_instance.<locals>.cls.__str__   	      r"   N)r1   r2   r3   r:   r|   r   rJ   )r{   r   s   r    r{   rs      se        % % %( ( ( ( (1 1 1! ! ! ! ! ! !r"   r{   RayTaskError()r\   r=   rG   rL   r1   r3   r   	cause_clsr   r{   r   s      @@r    rn   z1RayTaskError._make_normal_dual_exception_instance   s    J(	II		! 	! 	! 	! 	! 	! 	! 	!,	 	! 	! 	! 5y1444s4:r"   c                     | j         j        }t          |            G fddt          |          d|j         d}|_        |_         | j                   S )Nc                   @     e Zd Z fdZd ZfdZd ZfdZ xZS )FRayTaskError._make_exceptiongroup_dual_exception_instance.<locals>.clsc                 b    t                                          | |j        |j                  }|S r$   )r9   __new__message
exceptions)r{   r\   r   r=   s      r    r   zNRayTaskError._make_exceptiongroup_dual_exception_instance.<locals>.cls.__new__   s&    wwsEM5;KLLr"   c                 $    || _         |f| _        d S r$   ru   rv   s     r    r:   zORayTaskError._make_exceptiongroup_dual_exception_instance.<locals>.cls.__init__   rw   r"   c                     | j         fS r$   ry   rz   s    r    r|   zQRayTaskError._make_exceptiongroup_dual_exception_instance.<locals>.cls.__reduce__   r}   r"   c                 ,    t          | j        |          S r$   r   r   s     r    r   zRRayTaskError._make_exceptiongroup_dual_exception_instance.<locals>.cls.__getattr__   r   r"   c                     S r$   r6   r   s    r    rJ   zNRayTaskError._make_exceptiongroup_dual_exception_instance.<locals>.cls.__str__   r   r"   )	r1   r2   r3   r   r:   r|   r   rJ   r>   )r=   r{   r   s   @r    r{   r      s            % % %( ( ( ( (1 1 1! ! ! ! ! ! ! ! !r"   r{   r   r   r   r   s      @@r    rm   z9RayTaskError._make_exceptiongroup_dual_exception_instance   s    J(	II		! 	! 	! 	! 	! 	! 	! 	!,	 	! 	! 	!$ 5y1444s4:r"   c                    | j         j        }t          t          |          r| S 	 |                                 S # t
          $ r>}t                              dt          | j                    d|            | cY d}~S d}~ww xY w)a;  Returns an exception that's an instance of the cause's class.

        The returned exception inherits from both RayTaskError and the
        cause class and contains all of the attributes of the cause
        exception.

        If the cause class can't be subclassed, issues a warning and returns `self`.
        zUser exception type z in RayTaskError can't be subclassed! This exception is raised as RayTaskError only. You can use `ray_task_error.cause` to access the user exception. Failure in subclassing: N)	r\   r=   
issubclassrL   rp   r^   r_   r`   r   )r   r   rc   s      r    as_instanceof_causez RayTaskError.as_instanceof_cause   s     J(	lI.. 	K		44666 	 	 	NNKtDJ'7'7 K K HIK K   KKKKKK	s   9 
B3A<6B<Bc           	         | j                                                             d          }g }d}t          |          D ]#\  }}|                    d          rwt
          j        j         | j         dt
          j        j	         d| j
         d| j         }| j        r|d| j         d| j         d	z  }n|d	z  }d}|                    |           |                    d
          rad|v sd|v sd|v sd|v rQd|v r|                    d           |dz   t          |          k     r ||dz                                d          rd}|rd}|                    |           %d                    |          S )z"Format a RayTaskError as a string.r   Fz
Traceback z()z (pid=z, ip=z, actor_id=z, repr=r   z  File zray/worker.pyzray/_private/zray/util/tracing/zray/_raylet.pyxz&ray._raylet.raise_if_dependency_failedzJ  At least one of the input arguments for this task could not be computed:   z    T)rY   stripsplit	enumerate
startswithcoloramaForeCYANrO   RESETrT   rW   rZ   r[   appendlenr   )r   linesoutcode_from_internal_fileilinetraceback_lines          r    rJ   zRayTaskError.__str__   s   "((**0066"' !'' 1	! 1	!GAt|,, /!}) 5~5 5}*5 5 !H5 5 ,075 5  ? *"OdnOOT_OOONN #c)N*/'

>****++  !4''"d**&$..$,, <tCC
 JJ;   q53u::%%%A,*A*A&*I*I% /3+( ! +0''

4    yy~~r"   )NNNNN)re   rL   )
r1   r2   r3   r4   r:   rp   rn   rm   r   rJ   r6   r"   r    rL   rL   e   s          *) *) *) *)X; ; ; ;   0   8  0? ? ? ? ?r"   rL   c                       e Zd ZdZd ZdS )LocalRayletDiedErrorz,Indicates that the task's local raylet died.c                     dS )NzDThe task's local raylet died. Check raylet.out for more information.r6   ro   s    r    rJ   zLocalRayletDiedError.__str__<  s    UUr"   Nr1   r2   r3   r4   rJ   r6   r"   r    r   r   8  s.        66V V V V Vr"   r   c                       e Zd ZdZd ZdS )WorkerCrashedErrorzCIndicates that the worker died unexpectedly while executing a task.c                     	 dS )NzrThe worker died unexpectedly while executing this task. Check python-core-worker-*.log files for more information.r6   ro   s    r    rJ   zWorkerCrashedError.__str__D  s    I	
 	
r"   Nr   r6   r"   r    r   r   @  s)        MM
 
 
 
 
r"   r   c            	       |    e Zd ZdZdZdeddfdedededefd	Zd
efdZe	d
efd            Z
e	d
efd            ZdS )RayActorErrora  Indicates that the actor has outages unexpectedly before finishing a task.

    This exception could happen because the actor process is dead, or is unavailable for
    the moment. Ray raises subclasses `ActorDiedError` and `ActorUnavailableError`
    respectively.
    z:The actor experienced an error before finishing this task.NFrb   r   actor_init_failed	preemptedc                 >    || _         || _        || _        || _        d S r$   )rb   r   _actor_init_failed
_preempted)r   rb   r   r   r   s        r    r:   zRayActorError.__init__V  s%     !""3#r"   re   c                     | j         S r$   )r   ro   s    r    rJ   zRayActorError.__str__f  s
    ~r"   c                     | j         S r$   )r   ro   s    r    r   zRayActorError.preemptedi  s
    r"   c                     | j         S r$   )r   ro   s    r    r   zRayActorError.actor_init_failedm  s    &&r"   )r1   r2   r3   r4   BASE_ERROR_MSGrG   boolr:   rJ   propertyr   r   r6   r"   r    r   r   K  s          RN '"'$ $$ $  	$
 $ $ $ $      4    X '4 ' ' ' X' ' 'r"   r   c                   h     e Zd ZdZdZ	 ddeeeef                  f fdZ	e
defd            Z xZS )	ActorDiedErrorai  Indicates that the actor died unexpectedly before finishing a task.

    This exception could happen either because the actor process dies while
    executing a task, or because a task is submitted to a dead actor.

    Args:
        cause: The cause of the actor error. `RayTaskError` type means
            the actor has died because of an exception within `__init__`.
            `ActorDiedErrorContext` means the actor has died because of
            an unexpected system error. None means the cause isn't known.
            Theoretically, this shouldn't happen,
            but it's there as a safety check.
    z7The actor died unexpectedly before finishing this task.Nr\   c                 L   d}t           j        }d}d}|snt          |t                    r"d}|j        }d|                                 }nt          |t                    sJ t           j        g}|                    d|j                    |                    dt          |j
                                                              |j        dk    r|                    d|j                    |j        d	k    r|                    d
|j                    |j        d	k    r|                    d|j                    |j        d	k    r|                    d|j                    |                    |j                   |j        r|                    d           |j        r|j        j        t(          j        k    rd}d                    |          }t          |j
                                                  }t/                                          ||||           dS )zF
        Construct a RayActorError by building the arguments.
        NFTz@The actor died because of an error raised in its creation task, z	class_name: z	actor_id: r   z	pid: rF   z	name: z	namespace: z	ip: zAThe actor never ran - it was cancelled before it started running.r   )r   r   rk   rL   r[   rJ   r
   r   
class_namer   rb   hexrT   r   ray_namespacenode_ip_addressrC   never_startednode_death_inforeasonr   AUTOSCALER_DRAIN_PREEMPTEDr   r9   r:   )r   r\   rb   r   r   r   error_msg_linesr=   s          r    r:   zActorDiedError.__init__  sL    "1	!	 &	5|,, #	5 $H%==??% % I e%:;;;;;-<=O""#FE4D#F#FGGG""#Q'%.2I2I2M2M2O2O#Q#QRRRyA~~&&'<'<'<===zR&&'>%*'>'>???"b((&&'Lu7J'L'LMMM$**&&'G0E'G'GHHH""5#6777" &&W   %!)0 ;< < !			/22Iu~..2244H9.?KKKKKr"   
task_errorc                      t          |           S r$   )r   )r   s    r    from_task_errorzActorDiedError.from_task_error  s    j)))r"   r$   )r1   r2   r3   r4   r   r   r   rL   r
   r:   r5   r   r>   r?   s   @r    r   r   r  s          ON MQ3L 3LeL2G$GHI3L 3L 3L 3L 3L 3Lj *L * * * \* * * * *r"   r   c                   8     e Zd ZdZdedee         f fdZ xZS )ActorUnavailableErrorzLRaised when the actor is temporarily unavailable but may be available later.rC   rb   c                     |!t          |                                          nd }d| d| d}d}d}t                                          ||||           d S )Nz
The actor z is unavailable: z:. The task may or may not have been executed on the actor.F)r   r   r9   r:   )r   rC   rb   r   r   r   r=   s         r    r:   zActorUnavailableError.__init__  s    .6.B78$$((***7 7 7M 7 7 7 	 "	9.?KKKKKr"   )	r1   r2   r3   r4   rG   r   bytesr:   r>   r?   s   @r    r   r     sa        VV	Lc 	LXe_ 	L 	L 	L 	L 	L 	L 	L 	L 	L 	Lr"   r   c                        e Zd ZdZddZd ZdS )RaySystemErrorzpIndicates that Ray encountered a system error.

    This exception can be thrown when the raylet is killed.
    Nc                 "    || _         || _        d S r$   
client_excrY   )r   r   rY   s      r    r:   zRaySystemError.__init__  s    $*r"   c                 B    d| j          }| j        r|d| j         z  }|S )NzSystem error: z
traceback: r   r   s     r    rJ   zRaySystemError.__str__  s8    6T_66	 	>=);===Ir"   r$   r1   r2   r3   r4   r:   rJ   r6   r"   r    r   r     sA         
+ + + +    r"   r   c                   4     e Zd ZdZdef fdZdefdZ xZS )AuthenticationErrora  Indicates that an authentication error occurred.

    Most commonly, this is caused by a missing or mismatching token set on the client
    (e.g., a Ray CLI command interacting with a remote cluster).

    Only applicable when `RAY_AUTH_MODE` is not set to `disabled`.
    r   c                 f    || _         d| _        t                                          |           d S )NT)r   __suppress_context__r9   r:   )r   r   r=   s     r    r:   zAuthenticationError.__init__  s2     %)!!!!!!r"   re   c                     d}ddl m} ddlm}m}  |            }||j        k    r ||          }d| d}d}| j        dz   |z   |z   S )	NrF   r   )get_authentication_mode_name)AuthenticationModeget_authentication_modez# Note: RAY_AUTH_MODE is currently 'z' (not 'token').a   Ensure that the token for the cluster is available in a local file (e.g., ~/.ray/auth_token or via RAY_AUTH_TOKEN_PATH) or as the `RAY_AUTH_TOKEN` environment variable. To generate a token for local development, use `ray get-auth-token --generate` For remote clusters, ensure that the token is propagated to all nodes of the cluster when token authentication is enabled. For more information, see: https://docs.ray.io/en/latest/ray-security/token-auth.html.)0ray._private.authentication.authentication_utilsr   ray._rayletr   r   TOKENr   )r   auth_mode_noter   r   r   current_mode	mode_name	help_texts           r    rJ   zAuthenticationError.__str__  s    	
 	
 	
 	
 	
 	
 	LKKKKKKK..00-33344\BBIQiQQQ 
d 	 |c!N2Y>>r"   r1   r2   r3   r4   rG   r:   rJ   r>   r?   s   @r    r   r     si         " " " " " " "? ? ? ? ? ? ? ? ?r"   r   c                       e Zd ZdZdS )UserCodeExceptiona	  Indicates that an exception occurred while executing user code.
    For example, this exception can be used to wrap user code exceptions
    from a remote task or actor. The `retry_exceptions` parameter will
    still respect the underlying cause of this exception.Nr1   r2   r3   r4   r6   r"   r    r   r     s        = =
 	Dr"   r   c                   "     e Zd ZdZ fdZ xZS )ObjectStoreFullErrorzIndicates that the object store is full.

    This is raised if the attempt to store the object fails
    because the object store is full even after multiple retries.
    c                 X    t          t          |                                           dz   S )Nz
The local object store is full of objects that are still in scope and cannot be evicted. Tip: Use the `ray memory` command to list active objects in the cluster.)r9   r   rJ   r   r=   s    r    rJ   zObjectStoreFullError.__str__  s,    )40088::5
 	
r"   r1   r2   r3   r4   rJ   r>   r?   s   @r    r   r     sB         
 
 
 
 
 
 
 
 
r"   r   c                   "     e Zd ZdZ fdZ xZS )OutOfDiskErrorzIndicates that the local disk is full.

    This is raised if the attempt to store the object fails
    because both the object store and disk are full.
    c                 X    t          t          |                                           dz   S )Nz
The object cannot be created because the local object store is full and the local disk's utilization is over capacity (95% by default).Tip: Use `df` on this node to check disk usage and `ray memory` to check object store memory usage.)r9   r   rJ   r   s    r    rJ   zOutOfDiskError.__str__.  s+    ^T**2244?
 	
r"   r   r?   s   @r    r   r   &  sB         	
 	
 	
 	
 	
 	
 	
 	
 	
r"   r   c                       e Zd ZdZd Zd ZdS )OutOfMemoryErrorzIndicates that the node is running out of memory and is close to full.

    This is raised if the node is low on memory and tasks or actors are being
    evicted to free up memory.
    c                     || _         d S r$   r   r   r   s     r    r:   zOutOfMemoryError.__init__C      r"   c                     | j         S r$   r   ro   s    r    rJ   zOutOfMemoryError.__str__F  
    |r"   Nr   r6   r"   r    r   r   :  s<               r"   r   c                       e Zd ZdZd Zd ZdS )NodeDiedErrorz6Indicates that the node is either dead or unreachable.c                     || _         d S r$   r   r   s     r    r:   zNodeDiedError.__init__O  r   r"   c                     | j         S r$   r   ro   s    r    rJ   zNodeDiedError.__str__R  r   r"   Nr   r6   r"   r    r   r   J  s8        @@      r"   r   c                   $    e Zd ZdZd Zd Zd ZdS )ObjectLostErrorzIndicates that the object is lost from distributed memory, due to
    node failure or system error.

    Args:
        object_ref_hex: Hex ID of the object.
    c                 l    || _         || _        |                    t          j        d          | _        d S )Nz
  )object_ref_hexowner_addressreplaceray_constantsCALL_STACK_LINE_DELIMITER	call_site)r   r  r  r  s       r    r:   zObjectLostError.__init___  s5    ,*"**3V
 
r"   c                 P    d| j          d}| j        r|d| j         z  }n|dz  }|S )NzFailed to retrieve object z. zThe ObjectRef was created at: zTo see information about where this ObjectRef was created in Python, set the environment variable RAY_record_ref_creation_sites=1 during `ray start` and `ray.init()`.)r  r  rH   s     r    	_base_strzObjectLostError._base_strf  sL    B4+>BBB> 	DDNDDDCC C 
r"   c                 H    |                                  dz   d| j         dz   S )N

zAll copies of z have been lost due to node failure. Check cluster logs (`/tmp/ray/session_latest/logs`) for more information about the failure.r  r  ro   s    r    rJ   zObjectLostError.__str__s  s:    NN6!4 6 6 6	
r"   N)r1   r2   r3   r4   r:   r  rJ   r6   r"   r    r  r  V  sK         
 
 
  	
 	
 	
 	
 	
r"   r  c                       e Zd ZdZd ZdS )ObjectFetchTimedOutErrorzgIndicates that an object fetch timed out.

    Args:
        object_ref_hex: Hex ID of the object.
    c                 H    |                                  dz   d| j         dz   S )Nr  zFetch for object z` timed out because no locations were found for the object. This may indicate a system-level bug.r  ro   s    r    rJ   z ObjectFetchTimedOutError.__str__  s:    NN$D$7 $ $ $	
r"   Nr   r6   r"   r    r  r    -         	
 	
 	
 	
 	
r"   r  c                        e Zd ZdZddZd ZdS )RpcErrorz0Indicates an error in the underlying RPC system.Nc                 "    || _         || _        d S r$   )r   rpc_code)r   r   r  s      r    r:   zRpcError.__init__  s     r"   c                     | j         S r$   r   ro   s    r    rJ   zRpcError.__str__  r   r"   r$   r   r6   r"   r    r  r    s=        ::! ! ! !    r"   r  c                       e Zd ZdZd ZdS )ReferenceCountingAssertionErrorzIndicates that an object has been deleted while there was still a
    reference to it.

    Args:
        object_ref_hex: Hex ID of the object.
    c                 6    |                                  dz   dz   S )Nr  z_The object has already been deleted by the reference counting protocol. This should not happen.r  ro   s    r    rJ   z'ReferenceCountingAssertionError.__str__  s&    NN4	
r"   Nr   r6   r"   r    r  r    s-         
 
 
 
 
r"   r  c                       e Zd ZdZd ZdS )ObjectFreedErrorzIndicates that an object was manually freed by the application.

    Attributes:
        object_ref_hex: Hex ID of the object.
    c                 6    |                                  dz   dz   S )Nr  zThe object was manually freed using the internal `free` call. Please ensure that `free` is only called once the object is no longer needed.r  ro   s    r    rJ   zObjectFreedError.__str__  s&    NN!	
r"   Nr   r6   r"   r    r  r    r  r"   r  c                       e Zd ZdZd ZdS )OwnerDiedErrorzIndicates that the owner of the object has died while there is still a
    reference to the object.

    Args:
        object_ref_hex: Hex ID of the object.
    c                 .   d}| j         ro	 t                      }|                    | j                    |j        }t	          |j                  }d|                                 d| }n# t          $ r Y nw xY w|                                 dz   d| dz   S )Nz`/tmp/ray/session_latest/logs`z`/tmp/ray/session_latest/logs/*z*` at IP address r  zThe object's owner has exited. This is the Python worker that first created the ObjectRef via `.remote()` or `ray.put()`. Check cluster logs (z7) for more information about the Python worker failure.)	r  r   r%   
ip_addressr   	worker_idr   r,   r  )r   log_locaddrip_addrr%  s        r    rJ   zOwnerDiedError.__str__  s    2 	yy$$T%7888/$T^44	0immoo 0 0&-0 0       NN? (/? ? ?
	
s   AA) )
A65A6Nr   r6   r"   r    r"  r"    s-         
 
 
 
 
r"   r"  c                       e Zd ZdZd ZdS )ObjectReconstructionFailedErrorzpIndicates that the object cannot be reconstructed.

    Args:
        object_ref_hex: Hex ID of the object.
    c                 6    |                                  dz   dz   S )Nr  zThe object cannot be reconstructed because it was created by an actor, ray.put() call, or its ObjectRef was created by a different worker.r  ro   s    r    rJ   z'ObjectReconstructionFailedError.__str__  s&    NN?	
r"   Nr   r6   r"   r    r*  r*    r  r"   r*  c                       e Zd ZdZd ZdS )2ObjectReconstructionFailedMaxAttemptsExceededErrorzIndicates that the object cannot be reconstructed because the maximum
    number of task retries has been exceeded.

    Args:
        object_ref_hex: Hex ID of the object.
    c                 6    |                                  dz   dz   S )Nr  zThe object cannot be reconstructed because the maximum number of task retries has been exceeded. To prevent this error, set `@ray.remote(max_retries=<num retries>)` (default 3).r  ro   s    r    rJ   z:ObjectReconstructionFailedMaxAttemptsExceededError.__str__  s'    NNH		
r"   Nr   r6   r"   r    r-  r-    -         

 

 

 

 

r"   r-  c                       e Zd ZdZd ZdS )-ObjectReconstructionFailedLineageEvictedErrorzIndicates that the object cannot be reconstructed because its lineage
    was evicted due to memory pressure.

    Args:
        object_ref_hex: Hex ID of the object.
    c                 6    |                                  dz   dz   S )Nr  zThe object cannot be reconstructed because its lineage has been evicted to reduce memory pressure. To prevent this error, set the environment variable RAY_max_lineage_bytes=<bytes> (default 1GB) during `ray start`.r  ro   s    r    rJ   z5ObjectReconstructionFailedLineageEvictedError.__str__!  s'    NNR		
r"   Nr   r6   r"   r    r1  r1    r/  r"   r1  c                       e Zd ZdZdS )GetTimeoutErrorz.Indicates that a call to the worker timed out.Nr   r6   r"   r    r4  r4  .  s        88Dr"   r4  c                       e Zd ZdZdS )PlasmaObjectNotAvailablezACalled when an object was not available within the given timeout.Nr   r6   r"   r    r6  r6  5  s        KKDr"   r6  c                       e Zd ZdZdS )AsyncioActorExitzBRaised when an asyncio actor intentionally exits via exit_actor().Nr   r6   r"   r    r8  r8  <          LLDr"   r8  c                   &    e Zd ZdZddefdZd ZdS )RuntimeEnvSetupErrorzRaised when a runtime environment fails to be set up.

    Args:
        error_message: The error message that explains
            why runtime env setup has failed.
    NrC   c                     || _         d S r$   rC   r   rC   s     r    r:   zRuntimeEnvSetupError.__init__L      *r"   c                 t    dg}| j         r|                    | j                    d                    |          S )Nz%Failed to set up runtime environment.r   )rC   r   r   )r   msgss     r    rJ   zRuntimeEnvSetupError.__str__O  s:    78 	,KK*+++yyr"   r$   r1   r2   r3   r4   rG   r:   rJ   r6   r"   r    r;  r;  C  sM         + +c + + + +    r"   r;  c                       e Zd ZdZd ZdS )TaskPlacementGroupRemoved:Raised when the corresponding placement group was removed.c                     dS )Nz@The placement group corresponding to this task has been removed.r6   ro   s    r    rJ   z!TaskPlacementGroupRemoved.__str__Z  s    QQr"   Nr   r6   r"   r    rD  rD  V  s.        DDR R R R Rr"   rD  c                       e Zd ZdZd ZdS )ActorPlacementGroupRemovedrE  c                     dS )NzAThe placement group corresponding to this Actor has been removed.r6   ro   s    r    rJ   z"ActorPlacementGroupRemoved.__str__b  s    RRr"   Nr   r6   r"   r    rH  rH  ^  s.        DDS S S S Sr"   rH  c                       e Zd ZdZdS )PendingCallsLimitExceededzRaised when the pending actor calls exceeds `max_pending_calls` option.

    This exception could happen probably because the caller calls the callee
    too frequently.
    Nr   r6   r"   r    rK  rK  f  s          	Dr"   rK  c                   $    e Zd ZdZdefdZd ZdS )TaskUnschedulableErrorzRaised when the task cannot be scheduled.

    One example is that the node specified through
    NodeAffinitySchedulingStrategy is dead.
    rC   c                     || _         d S r$   r=  r>  s     r    r:   zTaskUnschedulableError.__init__y  r?  r"   c                     d| j          S )NzThe task is not schedulable: r=  ro   s    r    rJ   zTaskUnschedulableError.__str__|  s    Ct/ACCCr"   NrB  r6   r"   r    rM  rM  q  sM         +c + + + +D D D D Dr"   rM  c                   $    e Zd ZdZdefdZd ZdS )ActorUnschedulableErrorzRaised when the actor cannot be scheduled.

    One example is that the node specified through
    NodeAffinitySchedulingStrategy is dead.
    rC   c                     || _         d S r$   r=  r>  s     r    r:   z ActorUnschedulableError.__init__  r?  r"   c                     d| j          S )NzThe actor is not schedulable: r=  ro   s    r    rJ   zActorUnschedulableError.__str__  s    D0BDDDr"   NrB  r6   r"   r    rQ  rQ    sM         +c + + + +E E E E Er"   rQ  c                       e Zd ZdZdS )ObjectRefStreamEndOfStreamErrorzWRaised by streaming generator tasks when there are no more ObjectRefs to
    read.
    Nr   r6   r"   r    rU  rU              	Dr"   rU  c                       e Zd ZdZdS )(OufOfBandObjectRefSerializationExceptionznRaised when an `ray.ObjectRef` is out of band serialized by
    `ray.cloudpickle`. It is an anti pattern.
    Nr   r6   r"   r    rX  rX    rV  r"   rX  alpha)	stabilityc                       e Zd ZdZdS )RayChannelErrorz[Indicates that Ray encountered a system error related
    to ray.experimental.channel.
    Nr   r6   r"   r    r\  r\    rV  r"   r\  c                       e Zd ZdZdS )RayChannelTimeoutErrorz;Raised when the Compiled Graph channel operation times out.Nr   r6   r"   r    r^  r^    s        EEDr"   r^  c                       e Zd ZdZdS )RayCgraphCapacityExceededzBRaised when the Compiled Graph channel's buffer is at max capacityNr   r6   r"   r    r`  r`    r9  r"   r`  c                   $    e Zd ZdZdefdZd ZdS )r.   a  Raised when there is an error deserializing a serialized exception.

    This occurs when deserializing (unpickling) a previously serialized exception
    fails. In this case, we fall back to raising the string representation of
    the original exception along with its stack trace that was captured at the
    time of serialization.

    For more details and how to handle this with custom serializers, :ref:`configuring custom exeception serializers <custom-exception-serializer>`

    Args:
        original_stack_trace: The string representation and stack trace of the
            original exception that was captured during serialization.
    original_stack_tracec                     || _         d S r$   _original_stack_trace)r   rb  s     r    r:   z UnserializableException.__init__  s    %9"""r"   c                     d| j          S )NzFailed to deserialize exception. Refer to https://docs.ray.io/en/latest/ray-core/objects/serialization.html#custom-serializers-for-exceptions for more information.
Original exception:
rd  ro   s    r    rJ   zUnserializableException.__str__  s    ,), ,	
r"   NrB  r6   r"   r    r.   r.     sH         :S : : : :
 
 
 
 
r"   r.   c                   .     e Zd ZdZdef fdZd Z xZS )ActorAlreadyExistsErrora%  Raised when a named actor already exists.

    Note that this error is not only a subclass of RayError, but also a subclass of ValueError, to maintain backward compatibility.

    Args:
        error_message: The error message that contains information about the actor name and namespace.
    rC   c                 X    t                                          |           || _        d S r$   )r9   r:   rC   )r   rC   r=   s     r    r:   z ActorAlreadyExistsError.__init__  s)    '''*r"   c                     | j         S r$   r=  ro   s    r    rJ   zActorAlreadyExistsError.__str__  s    !!r"   r   r?   s   @r    rh  rh    s]         +c + + + + + +" " " " " " "r"   rh  )NloggingrR   ri   	tracebackr   typingr   r   r   ray._private.ray_constants_privater	  ray.cloudpicklecloudpickler   r   r   r   r   ray.core.generated.common_pb2r	   r
   r   r   r   r   ray.util.annotationsr   r   	getLoggerr1   r_   r,   r   r/   rA   rL   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  AssertionErrorr  r  r"  r*  r-  r1  TimeoutErrorr4  r6  r8  r;  rD  rH  rK  rM  rQ  rU  rX  r\  r^  r`  r.   
ValueErrorrh  RAY_EXCEPTION_TYPESr6   r"   r    <module>ry     s    				 



 & & & & & & " " " " " " " "  2 2 2 2 2 2 2 2 2             1 1 1 1 1 1 1 1 1 1                9 8 8 8 8 8 8 8		8	$	$ #5 #5 #5 #5 #5y #5 #5 #5L 	
 	
 	
 	
 	
 	
 	
 	
        . O O O O O8 O O Od V V V V V8 V V V 
 
 
 
 
 
 
 
 #' #' #' #' #'H #' #' #'L H* H* H* H* H*] H* H* H*V L L L L LM L L L     X   " '? '? '? '? '?( '? '? '?T 	 	 	 	 	 	 	 	 
 
 
 
 
8 
 
 
  
 
 
 
 
X 
 
 
&     x        H    %
 %
 %
 %
 %
h %
 %
 %
P 
 
 
 
 
 
 
 
&     x    
 
 
 
 
o~ 
 
 
& 
 
 
 
 
 
 
 
& #
 #
 #
 #
 #
_ #
 #
 #
L 
 
 
 
 
o 
 
 
& 
 
 
 
 
 
 
 
* 
 
 
 
 
O 
 
 
* 	 	 	 	 	h 	 	 	 	 	 	 	 	x 	 	 	 	 	 	 	 	x 	 	 	     8   $ R R R R R R R R S S S S S S S S 	 	 	 	 	 	 	 	 D D D D DX D D D E E E E Eh E E E 	 	 	 	 	h 	 	 	 	 	 	 	 	x 	 	 	 W	 	 	 	 	n 	 	 	 W	 	 	 	 	_l 	 	 	 W	 	 	 	 	 	 	 	 W
 
 
 
 
h 
 
 
4 " " " " "j( " " ""      	 
         $  $  7  2         ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 -7 8 9 : ; < = > ?    r"   