ray.kill(actor: ActorHandle, *, no_restart: bool = True)[source]#

Kill an actor forcefully.

This will interrupt any running tasks on the actor, causing them to fail immediately. atexit handlers installed in the actor will not be run.

If you want to kill the actor but let pending tasks finish, you can call actor.__ray_terminate__.remote() instead to queue a termination task. Any atexit handlers installed in the actor will be run in this case.

If the actor is a detached actor, subsequent calls to get its handle via ray.get_actor will fail.

  • actor – Handle to the actor to kill.

  • no_restart – Whether or not this actor should be restarted if it’s a restartable actor.