mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
[Serve] Wait for actor name to be cleaned up (#12215)
This commit is contained in:
parent
231518e86f
commit
b56db5a22f
1 changed files with 18 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
import atexit
|
||||
import time
|
||||
from functools import wraps
|
||||
import os
|
||||
from uuid import UUID
|
||||
|
@ -81,9 +82,25 @@ class Client:
|
|||
Shuts down all processes and deletes all state associated with the
|
||||
instance.
|
||||
"""
|
||||
if not self._shutdown:
|
||||
if (not self._shutdown) and ray.is_initialized():
|
||||
ray.get(self._controller.shutdown.remote())
|
||||
ray.kill(self._controller, no_restart=True)
|
||||
|
||||
# Wait for the named actor entry gets removed as well.
|
||||
started = time.time()
|
||||
while True:
|
||||
try:
|
||||
ray.get_actor(self._controller_name)
|
||||
if time.time() - started > 5:
|
||||
logger.warning(
|
||||
"Waited 5s for Serve to shutdown gracefully but "
|
||||
"the controller is still not cleaned up. "
|
||||
"You can ignore this warning if you are shutting "
|
||||
"down the Ray cluster.")
|
||||
break
|
||||
except ValueError: # actor name is removed
|
||||
break
|
||||
|
||||
self._shutdown = True
|
||||
|
||||
@_ensure_connected
|
||||
|
|
Loading…
Add table
Reference in a new issue