communicator_handle.py 689 B

12345678910111213141516171819202122232425262728
  1. from typing import List
  2. import ray
  3. class CommunicatorHandle:
  4. """
  5. A lightweight communicator handle used by the driver to store handles to
  6. the actors in the communicator.
  7. """
  8. def __init__(
  9. self,
  10. actor_handles: List["ray.actor.ActorHandle"],
  11. ):
  12. """
  13. Initializes the CommunicatorHandle with the given actor handles.
  14. Args:
  15. actor_handles: A list of actor handles to be stored.
  16. """
  17. self._actor_handles = actor_handles
  18. def get_actor_handles(self) -> List["ray.actor.ActorHandle"]:
  19. """
  20. Retuan all actor handles in this communicator.
  21. """
  22. return self._actor_handles