o
    `۷i                     @   sv   d dl mZ d dlmZ d dlmZ eddG dd deZeddG dd	 d	eZeddG d
d deZdS )    )Dict)RayTrainError)	PublicAPIalpha)	stabilityc                   @   s   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__ r   r   Q/home/ubuntu/vllm_env/lib/python3.10/site-packages/ray/train/v2/api/exceptions.pyr      s    r   c                       s:   e Zd ZdZdedeeef f fddZdd Z	  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                    s    t  d|  || _|| _d S )Nz&Training failed due to worker errors:
)super__init___error_messager   )selfr   r   	__class__r   r   r      s   
zWorkerGroupError.__init__c                 C   s   | j | j| jffS N)r   r   r   r   r   r   r   
__reduce__   s   zWorkerGroupError.__reduce__)r   r	   r
   r   strr   int	Exceptionr   r   __classcell__r   r   r   r   r      s    r   c                       s.   e Zd ZdZdef fddZdd Z  ZS )ControllerErrorzException raised when training fails due to a controller error.

    Args:
        controller_failure: The exception that occurred on the controller.
    controller_failurec                    s*   t  dt|  || _| |j d S )Nz)Training failed due to controller error:
)r   r   r   r   with_traceback__traceback__)r   r   r   r   r   r   )   s
   
zControllerError.__init__c                 C   s   | j | jffS r   )r   r   r   r   r   r   r   0   s   zControllerError.__reduce__)r   r	   r
   r   r   r   r   r   r   r   r   r   r   !   s    r   N)	typingr   !ray.train.v2._internal.exceptionsr   ray.util.annotationsr   r   r   r   r   r   r   r   <module>   s    