o
    $i                     @   s   d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ edZe eZe
G d	d
 d
Ze
G dd dedZdS )    Nnullcontext)TypeVar)BaseWorkerGroup)	Singleton)DeveloperAPI)make_table_html_reprEncodedDatac                   @   s6   e Zd ZdZedd Zedd ZdefddZd	S )
BackendConfigz4Parent class for configurations of training backend.c                 C      t S N)Backendself r   N/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/ray/train/backend.pybackend_cls      zBackendConfig.backend_clsc                 C   r   r   r   r   r   r   r   train_func_context   r   z BackendConfig.train_func_contextreturnc                 C   s   t | t| jdS )N)objtitle)r   type__name__r   r   r   r   _repr_html_   s   zBackendConfig._repr_html_N)	r   
__module____qualname____doc__propertyr   r   strr   r   r   r   r   r
      s    

r
   c                   @   sT   e Zd ZU dZdZeed< dedefddZ	dedefdd	Z
dedefd
dZdS )r   a  Singleton for distributed communication backend.

    Attributes:
        share_cuda_visible_devices: If True, each worker
            process will have CUDA_VISIBLE_DEVICES set as the visible device
            IDs of all workers on the same node for this training instance.
            If False, each worker will have CUDA_VISIBLE_DEVICES set to the
            device IDs allocated by Ray for that worker.
    Fshare_cuda_visible_devicesworker_groupbackend_configc                 C      dS )z Logic for starting this backend.Nr   r   r!   r"   r   r   r   on_start-   r   zBackend.on_startc                 C   r#   )z$Logic for shutting down the backend.Nr   r$   r   r   r   on_shutdown1   r   zBackend.on_shutdownc                 C   r#   )z\Logic ran right before training is started.

        Session API is available at this point.Nr   r$   r   r   r   on_training_start5   s   zBackend.on_training_startN)r   r   r   r   r    bool__annotations__r   r
   r%   r&   r'   r   r   r   r   r      s   
 
r   )	metaclass)logging
contextlibr   typingr   %ray.train._internal.base_worker_groupr   ray.train._internal.utilsr   ray.util.annotationsr   ray.widgetsr   r	   	getLoggerr   loggerr
   r   r   r   r   r   <module>   s    
