Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] ray.actor.exit_actor() does not seem to work from within an async background thread #49451

Open
shomilj opened this issue Dec 26, 2024 · 0 comments
Labels
bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component)

Comments

@shomilj
Copy link
Contributor

shomilj commented Dec 26, 2024

What happened + What you expected to happen

In actor initialization, I want to spawn an async background routine that has the ability to call ray.actor.exit_actor(); however, that API doesn't seem to actually work -

>>> AsyncActor.remote()
2024-12-26 14:20:31,392 INFO worker.py:1743 -- Started a local Ray instance. View the dashboard at 127.0.0.1:8265 
Actor(AsyncActor, e6db65d56c5f1e1f1122d91301000000)
>>> (AsyncActor pid=2151093) Exiting actor

The actor stays alive (according to Ray dashboard) instead of exiting as I would expect.

Versions / Dependencies

Ray 2.40.0

Reproduction script

import ray
import asyncio

@ray.remote
class AsyncActor:
    def __init__(self) -> None:
        self.task = asyncio.get_running_loop().create_task(
            self.start()
        )

    async def start(self):
        print("Exiting actor")
        ray.actor.exit_actor()
        print("Exited actor")

Issue Severity

Medium: It is a significant difficulty but I can work around it.

@shomilj shomilj added bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component)
Projects
None yet
Development

No branches or pull requests

1 participant