Beispiel #1
0
 def get_actor(self, name: str) -> ClientActorHandle:
     task = ray_client_pb2.ClientTask()
     task.type = ray_client_pb2.ClientTask.NAMED_ACTOR
     task.name = name
     ids = self._call_schedule_for_task(task)
     assert len(ids) == 1
     return ClientActorHandle(ClientActorRef(ids[0]))
Beispiel #2
0
 def persistent_load(self, pid):
     assert isinstance(pid, PickleStub)
     if pid.type == "Object":
         return ClientObjectRef(pid.ref_id)
     elif pid.type == "Actor":
         return ClientActorHandle(ClientActorRef(pid.ref_id))
     else:
         raise NotImplementedError("Being passed back an unknown stub")
Beispiel #3
0
 def get_actor(self, name: str,
               namespace: Optional[str] = None) -> ClientActorHandle:
     task = ray_client_pb2.ClientTask()
     task.type = ray_client_pb2.ClientTask.NAMED_ACTOR
     task.name = name
     task.namespace = namespace or ""
     ids = self._call_schedule_for_task(task, num_returns=1)
     assert len(ids) == 1
     return ClientActorHandle(ClientActorRef(ids[0]))
Beispiel #4
0
 def get_actor(self,
               name: str,
               namespace: Optional[str] = None) -> ClientActorHandle:
     task = ray_client_pb2.ClientTask()
     task.type = ray_client_pb2.ClientTask.NAMED_ACTOR
     task.name = name
     task.namespace = namespace or ""
     futures = self._call_schedule_for_task(task, 1)
     assert len(futures) == 1
     handle = ClientActorHandle(ClientActorRef(futures[0]))
     # `actor_ref.is_nil()` waits until the underlying ID is resolved.
     # This is needed because `get_actor` is often used to check the
     # existence of an actor.
     if handle.actor_ref.is_nil():
         raise ValueError(f"ActorID for {name} is empty")
     return handle