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] AttributeError: module 'ray.util' has no attribute 'state' #48656

Closed
miguelteixeiraa opened this issue Nov 8, 2024 · 2 comments
Closed
Labels
bug Something that is supposed to be working; but isn't core Issues that should be addressed in Ray Core triage Needs triage (eg: priority, bug/not-bug, and owning component)

Comments

@miguelteixeiraa
Copy link
Contributor

miguelteixeiraa commented Nov 8, 2024

What happened + What you expected to happen

I can't use the StateAPI. Are these alpha APIs expected to be available on Windows and Mac? When I try to use it I get the following error (on Mac -- did not test on Windows):

AttributeError: module 'ray.util' has no attribute 'state'

Versions / Dependencies

OS: macOS Sonoma 14.6
Python: 3.11.9
ray-2.38.0

Reproduction script

from time import sleep
import ray


ray.init()


@ray.remote
class CounterActor:
    def __init__(self):
        self._counter = 0

    def run(self):
        while True:
            sleep(1)
            self._counter += 1
            print(self._counter)


counter = CounterActor.options(name="named-actor").remote()
counter.run.remote()

while True:
    sleep(1)
    actors_list = ray.util.state.list_actors()
    print(actors_list)
 line 25, in <module>
    actors_list = ray.util.state.list_actors()
                  ^^^^^^^^^^^^^^
AttributeError: module 'ray.util' has no attribute 'state'

Issue Severity

High: It blocks me from completing my task.

@miguelteixeiraa miguelteixeiraa added bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Nov 8, 2024
@jcotant1 jcotant1 added the core Issues that should be addressed in Ray Core label Nov 8, 2024
@miguelteixeiraa miguelteixeiraa changed the title [Ray Core] AttributeError: module 'ray.util' has no attribute 'state' [Core] AttributeError: module 'ray.util' has no attribute 'state' Nov 8, 2024
@Superskyyy
Copy link
Contributor

Superskyyy commented Nov 8, 2024

You should do from ray.util import state or from ray.util.state import get_actor, list_actors

@jcotant1 jcotant1 added test core Issues that should be addressed in Ray Core and removed test core Issues that should be addressed in Ray Core labels Nov 8, 2024
@miguelteixeiraa
Copy link
Contributor Author

Oh yeah. That worked! Thank you so much!!!

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 core Issues that should be addressed in Ray Core triage Needs triage (eg: priority, bug/not-bug, and owning component)
Projects
None yet
Development

No branches or pull requests

3 participants