
    &`i                         d dl mZ d dlmZ d dlmZ  ed           G d de                      Z ed           G d d	e                      Z ed           G d
 de                      ZdS )    )Dict)RayTrainError)	PublicAPIalpha)	stabilityc                       e Zd ZdZdS )TrainingFailedErrorzException raised when training fails from a `trainer.fit()` call.
    This is either :class:`ray.train.WorkerGroupError` or :class:`ray.train.ControllerError`.
    N)__name__
__module____qualname____doc__     o/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/train/v2/api/exceptions.pyr	   r	      s           r   r	   c                   B     e Zd ZdZdedeeef         f fdZd Z	 xZ
S )WorkerGroupErrora%  Exception raised from the worker group during training.

    Args:
        error_message: A human-readable error message describing the training worker failures.
        worker_failures: A mapping from worker rank to the exception that
            occurred on that worker during training.
    error_messageworker_failuresc                 l    t                                          d|z              || _        || _        d S )Nz&Training failed due to worker errors:
)super__init___error_messager   )selfr   r   	__class__s      r   r   zWorkerGroupError.__init__   s7    B]RSSS+.r   c                 ,    | j         | j        | j        ffS N)r   r   r   r   s    r   
__reduce__zWorkerGroupError.__reduce__   s    !4d6J KLLr   )r
   r   r   r   strr   int	Exceptionr   r   __classcell__r   s   @r   r   r      st         /c /Di<P / / / / / /
M M M M M M Mr   r   c                   .     e Zd ZdZdef fdZd Z xZS )ControllerErrorzException raised when training fails due to a controller error.

    Args:
        controller_failure: The exception that occurred on the controller.
    controller_failurec                     t                                          dt          |          z              || _        |                     |j                   d S )Nz)Training failed due to controller error:
)r   r   r   r&   with_traceback__traceback__)r   r&   r   s     r   r   zControllerError.__init__)   sX    83?Q;R;RR	
 	
 	
 #5.<=====r   c                      | j         | j        ffS r   )r   r&   r   s    r   r   zControllerError.__reduce__0   s    !8 :;;r   )r
   r   r   r   r!   r   r   r"   r#   s   @r   r%   r%   !   s]         >9 > > > > > >< < < < < < <r   r%   N)	typingr   !ray.train.v2._internal.exceptionsr   ray.util.annotationsr   r	   r   r%   r   r   r   <module>r.      s         ; ; ; ; ; ; * * * * * * W    -    WM M M M M* M M M$ W< < < < <) < < < < <r   