예제 #1
0
파일: worker.py 프로젝트: tseiger1/ray
 def terminate_actor(self, actor: ClientActorHandle,
                     no_restart: bool) -> None:
     if not isinstance(actor, ClientActorHandle):
         raise ValueError("ray.kill() only supported for actors. "
                          "Got: {}.".format(type(actor)))
     term_actor = ray_client_pb2.TerminateRequest.ActorTerminate()
     term_actor.handle = actor.actor_ref.handle
     term_actor.no_restart = no_restart
     try:
         term = ray_client_pb2.TerminateRequest(actor=term_actor)
         self.server.Terminate(term)
     except grpc.RpcError as e:
         raise decode_exception(e.details())
예제 #2
0
 def terminate_actor(self, actor: ClientActorHandle, no_restart: bool) -> None:
     if not isinstance(actor, ClientActorHandle):
         raise ValueError(
             "ray.kill() only supported for actors. Got: {}.".format(type(actor))
         )
     term_actor = ray_client_pb2.TerminateRequest.ActorTerminate()
     term_actor.id = actor.actor_ref.id
     term_actor.no_restart = no_restart
     term = ray_client_pb2.TerminateRequest(actor=term_actor)
     term.client_id = self._client_id
     try:
         self.data_client.Terminate(term)
     except grpc.RpcError as e:
         raise decode_exception(e)
예제 #3
0
파일: worker.py 프로젝트: tseiger1/ray
 def terminate_task(self, obj: ClientObjectRef, force: bool,
                    recursive: bool) -> None:
     if not isinstance(obj, ClientObjectRef):
         raise TypeError(
             "ray.cancel() only supported for non-actor object refs. "
             f"Got: {type(obj)}.")
     term_object = ray_client_pb2.TerminateRequest.TaskObjectTerminate()
     term_object.handle = obj.handle
     term_object.force = force
     term_object.recursive = recursive
     try:
         term = ray_client_pb2.TerminateRequest(task_object=term_object)
         self.server.Terminate(term)
     except grpc.RpcError as e:
         raise decode_exception(e.details())
예제 #4
0
 def terminate_actor(self, actor: ClientActorHandle,
                     no_restart: bool) -> None:
     if not isinstance(actor, ClientActorHandle):
         raise ValueError("ray.kill() only supported for actors. "
                          "Got: {}.".format(type(actor)))
     term_actor = ray_client_pb2.TerminateRequest.ActorTerminate()
     term_actor.id = actor.actor_ref.id
     term_actor.no_restart = no_restart
     try:
         term = ray_client_pb2.TerminateRequest(actor=term_actor)
         term.client_id = self._client_id
         metadata = self._add_ids_to_metadata(self.metadata)
         self._call_stub("Terminate", term, metadata=metadata)
     except grpc.RpcError as e:
         raise decode_exception(e)
예제 #5
0
 def terminate_task(self, obj: ClientObjectRef, force: bool,
                    recursive: bool) -> None:
     if not isinstance(obj, ClientObjectRef):
         raise TypeError(
             "ray.cancel() only supported for non-actor object refs. "
             f"Got: {type(obj)}.")
     term_object = ray_client_pb2.TerminateRequest.TaskObjectTerminate()
     term_object.id = obj.id
     term_object.force = force
     term_object.recursive = recursive
     try:
         term = ray_client_pb2.TerminateRequest(task_object=term_object)
         term.client_id = self._client_id
         metadata = self._add_ids_to_metadata(self.metadata)
         self._call_stub("Terminate", term, metadata=metadata)
     except grpc.RpcError as e:
         raise decode_exception(e)