o
    $i                     @   sf   d dl mZmZmZmZ d dlmZ d dlmZ d dl	m
Z
 e
G dd dZe
G dd deZd	S )
    )AnyDictListOptional)
Checkpoint)TrainRunContext)DeveloperAPIc                   @   s   e Zd ZdZdS )RayTrainCallbackz"Base Ray Train callback interface.N)__name__
__module____qualname____doc__ r   r   V/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/ray/train/v2/api/callback.pyr	      s    r	   c                   @   sP   e Zd ZdZdedeeeef  de	e
 fddZdedeeef fdd	Zd
S )UserCallbackzCallback interface for custom user-defined callbacks to handling events
    during training.

    This callback is called on the Ray Train controller process, not on the
    worker processes.
    run_contextmetrics
checkpointc                 C      dS )a*  Called after all workers have reported a metric + checkpoint
        via `ray.train.report`.

        Args:
            run_context: The `TrainRunContext` for the current training run.
            metrics: A list of metric dictionaries reported by workers,
                where metrics[i] is the metrics dict reported by worker i.
            checkpoint: A Checkpoint object that has been persisted to
                storage. This is None if no workers reported a checkpoint
                (e.g. `ray.train.report(metrics, checkpoint=None)`).
        Nr   )selfr   r   r   r   r   r   after_report   s   zUserCallback.after_reportworker_exceptionsc                 C   r   )a  Called after one or more workers have raised an exception.

        Args:
            run_context: The `TrainRunContext` for the current training run.
            worker_exceptions: A dict from worker world rank to the exception
                raised by that worker.
        Nr   )r   r   r   r   r   r   after_exception+   s   
zUserCallback.after_exceptionN)r
   r   r   r   r   r   r   strr   r   r   r   int	Exceptionr   r   r   r   r   r      s    

r   N)typingr   r   r   r   	ray.trainr   (ray.train.v2._internal.execution.contextr   ray.util.annotationsr   r	   r   r   r   r   r   <module>   s    