diff --git a/python/ray/actor.py b/python/ray/actor.py index 6a4819471bc78..800a5eaad605e 100644 --- a/python/ray/actor.py +++ b/python/ray/actor.py @@ -1775,9 +1775,13 @@ def exit_actor(): # In asyncio actor mode, we can't raise SystemExit because it will just # quit the asycnio task, not the main thread. Instead, we use # asyncio.Event for synchronization across multiple asyncio tasks. + class MyError(Exception): + pass + if worker.core_worker.current_actor_is_asyncio(): worker.core_worker.is_current_async_actor_exited = True - return + # return + raise MyError() # Set a flag to indicate this is an intentional actor exit. This # reduces log verbosity.