mirror of
https://github.com/wassname/ray.git
synced 2026-06-30 05:57:18 +08:00
Fix exit_actor in asyncio mode (#12693)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import inspect
|
||||
import logging
|
||||
import weakref
|
||||
import _thread
|
||||
|
||||
import ray.ray_constants as ray_constants
|
||||
import ray._raylet
|
||||
@@ -1018,6 +1019,14 @@ def exit_actor():
|
||||
ray.disconnect()
|
||||
# Disconnect global state from GCS.
|
||||
ray.state.state.disconnect()
|
||||
|
||||
# In asyncio actor mode, we can't raise SystemExit because it will just
|
||||
# quit the asycnio event loop thread, not the main thread. Instead, we
|
||||
# raise an interrupt signal to the main thread to tell it to exit.
|
||||
if worker.core_worker.current_actor_is_asyncio():
|
||||
_thread.interrupt_main()
|
||||
return
|
||||
|
||||
# Set a flag to indicate this is an intentional actor exit. This
|
||||
# reduces log verbosity.
|
||||
exit = SystemExit(0)
|
||||
|
||||
Reference in New Issue
Block a user