o
    `Û·i  ã                   @   s€   d dl mZmZmZ d dlZd dlmZ 	ddee dedeeeeef f fdd	„Z	dee deeeeef f fd
d„Z
dS )é    )ÚAnyÚDictÚListN)Ú	ObjectReféÿÿÿÿÚobj_refsÚ
timeout_msÚreturnc                 C   s$   t  ¡ stdƒ‚t jjjj | |¡S )ad  Lookup the locations for a list of objects.

    It returns a dict maps from an object to its location. The dict excludes
    those objects whose location lookup failed.

    Args:
        object_refs (List[ObjectRef]): List of object refs.
        timeout_ms: The maximum amount of time in micro seconds to wait
            before returning. Wait infinitely if it's negative.

    Returns:
        A dict maps from an object to its location. The dict excludes those
        objects whose location lookup failed.

        The location is stored as a dict with following attributes:

        - node_ids (List[str]): The hex IDs of the nodes that have a
          copy of this object. Objects less than 100KB will be in memory
          store not plasma store and therefore will have nodes_id = [].

        - object_size (int): The size of data + metadata in bytes. Can be None if the
          size is unknown yet (e.g. task not completed).

    Raises:
        RuntimeError: if the processes were not started by ray.init().
        ray.exceptions.GetTimeoutError: if it couldn't finish the
            request in time.
    úRay hasn't been initialized.)ÚrayÚis_initializedÚRuntimeErrorÚ_privateÚworkerÚglobal_workerÚcore_workerÚget_object_locations)r   r   © r   úP/home/ubuntu/vllm_env/lib/python3.10/site-packages/ray/experimental/locations.pyr      s
   ÿr   c                 C   s&   t  ¡ stdƒ‚t jjjj}| | ¡S )a¿  Lookup the locations for a list of objects *from the local core worker*. No RPCs
    are made in this method.

    It returns a dict maps from an object to its location. The dict excludes
    those objects whose location lookup failed.

    Args:
        object_refs (List[ObjectRef]): List of object refs.

    Returns:
        A dict maps from an object to its location. The dict excludes those
        objects whose location lookup failed.

        The location is stored as a dict with following attributes:

        - node_ids (List[str]): The hex IDs of the nodes that have a
          copy of this object. Objects less than 100KB will be in memory
          store not plasma store and therefore will have nodes_id = [].

        - object_size (int): The size of data + metadata in bytes. Can be None if the
          size is unknown yet (e.g. task not completed).

    Raises:
        RuntimeError: if the processes were not started by ray.init().
    r
   )r   r   r   r   r   r   r   Úget_local_object_locations)r   r   r   r   r   r   -   s   
r   )r   )Útypingr   r   r   r   Úray._rayletr   ÚintÚstrr   r   r   r   r   r   Ú<module>   s     ÿÿÿ
þ&ÿþ