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][Actors] Duplicate named actor exception should not be lazy if possible #44906

Open
glindstr opened this issue Apr 22, 2024 · 1 comment
Labels
core Issues that should be addressed in Ray Core docs An issue or change related to documentation good first issue Great starter issue for someone just starting to contribute to Ray P1 Issue that should be fixed within a few weeks

Comments

@glindstr
Copy link

What happened + What you expected to happen

Ray enforces the uniqueness of named actors within a namespace which is a great feature. I ran into an unexpected issue where an exception for creating a duplicate named actor doesn't present itself until the duplicate actor is interacted with. Is it feasible to make the exception thrown when creating a duplicate named remote actor?

Versions / Dependencies

Ray 2.10.0

Reproduction script

import ray
import time

@ray.remote
class TestActor:       
    def do_work(self):
        time.sleep(5)


ray.init(address="...")

name = "test"
namespace = 'namespace'

actor1 = TestActor.options(name=name, namespace=namespace, lifetime='detached').remote()
actor2 = TestActor.options(name=name, namespace=namespace, lifetime='detached').remote()

time.sleep(10)

actor1.do_work.remote()
actor2.do_work.remote() #Exception: Actor name already taken

Issue Severity

Low: It annoys or frustrates me.

@glindstr glindstr added bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Apr 22, 2024
@glindstr
Copy link
Author

glindstr commented Apr 22, 2024

I see now that ray.actor.ActorClass.options has "get_if_exists" parameter which makes this potential bug a non-issue:

actor1 = TestActor.options(name=name, namespace=namespace, lifetime='detached', get_if_exists=True).remote()

Ideally this parameter is added to the api documentation:

https://docs.ray.io/en/latest/ray-core/api/doc/ray.actor.ActorClass.options.html#ray.actor.ActorClass.options

@anyscalesam anyscalesam added the core Issues that should be addressed in Ray Core label Apr 23, 2024
@jjyao jjyao added P1 Issue that should be fixed within a few weeks docs An issue or change related to documentation and removed triage Needs triage (eg: priority, bug/not-bug, and owning component) bug Something that is supposed to be working; but isn't labels Apr 29, 2024
@hongchaodeng hongchaodeng added the good first issue Great starter issue for someone just starting to contribute to Ray label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues that should be addressed in Ray Core docs An issue or change related to documentation good first issue Great starter issue for someone just starting to contribute to Ray P1 Issue that should be fixed within a few weeks
Projects
None yet
Development

No branches or pull requests

4 participants