
    &`iF                         d Z ddlZddlZddlZ ej        e          Zej         G d d                      Zej         G d d                      Z	dS )z#Some utility class for Collectives.    Nc                   *    e Zd ZdZd Zd Zd Zd ZdS )NCCLUniqueIDStorezNCCLUniqueID Store as a named actor class.

    Args:
        name: the unique name for this named actor.

    Attributes:
        name: the unique name for this named actor.
        nccl_id: the NCCLUniqueID held in this store.
    c                 R    || _         d | _        t          j                    | _        d S )N)namenccl_idasyncioEventevent)selfr   s     l/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/util/collective/util.py__init__zNCCLUniqueIDStore.__init__   s!    	]__


    c                 J   K   || _         | j                                         |S )z
        Initialize the NCCL unique ID for this store.

        Args:
            uid: the unique ID generated via the NCCL generate_communicator_id API.

        Returns:
            The NCCL unique ID set.
        )r   r
   set)r   uids     r   set_idzNCCLUniqueIDStore.set_id   s&       

r   c                 R   K   | j                                          d{V  | j        S )z4Wait for the NCCL unique ID to be set and return it.N)r
   waitr   r   s    r   wait_and_get_idz!NCCLUniqueIDStore.wait_and_get_id)   s2      joo|r   c                     | j         s2t                              d                    | j                             | j         S )z*Get the NCCL unique ID held in this store.z.The NCCL ID has not been set yet for store {}.)r   loggerwarningformatr   r   s    r   get_idzNCCLUniqueIDStore.get_id.   s?    | 	NN@GG	RR   |r   N)__name__
__module____qualname____doc__r   r   r   r    r   r   r   r   
   sZ         % % %
    
    r   r   c                   $    e Zd ZdZd Zd Zd ZdS )InfozrStore the group information created via `create_collective_group`.

    Note: Should be used as a NamedActor.
    c                 L    d | _         d| _        d| _        d | _        d| _        d S )Ni0u  ids
world_sizerankbackendgloo_timeoutr   s    r   r   zInfo.__init__>   s,    	!r   c                 L    || _         || _        || _        || _        || _        dS )zStore collective information.Nr%   )r   r&   r'   r(   r)   r*   s         r   set_infozInfo.set_infoE   s,    $	(r   c                 B    | j         | j        | j        | j        | j        fS )z-Get previously stored collective information.r%   r   s    r   get_infozInfo.get_infoM   s(     HOIL
 	
r   N)r   r   r   r   r   r,   r.   r    r   r   r"   r"   7   sK         
" " ") ) )
 
 
 
 
r   r"   )
r   r   loggingray	getLoggerr   r   remoter   r"   r    r   r   <module>r3      s    ) )   



		8	$	$ ) ) ) ) ) ) ) )X 
 
 
 
 
 
 
 
 
 
r   