How to get the status of all actors?

Hi, how can I get the status of all the methods of all actors?

Hi @GoingMyWay , sorry for the delay.

We are currently working on improving the observability of the ray cluster with Ray state APIs. It is still in alpha and only available on nightly build. So apologize for the lack of docs and potential bugs. But if you are able to run with a nightly build or build ray from source, you could try the below snippets:

# Getting all the actors summary 
> ray summary actors 

# Listing all the actors or the tasks
> ray list actors
> ray list tasks

# Or a particular class of actors that are alive. 
> ray list actors -f class_name="XXX" -f state="ALIVE"

For a more comprehensive list of filterable keys, see this: ray/common.py at master · ray-project/ray · GitHub

You could also look at the logs of a specific actor:

# Get the actor id from listing the actors
> ray list actors 

# Stream the actor log 
> ray logs -f --actor-id=XXX 

The above CLI examples are also simply a wrapper on the Python SDKs: ray/api.py at master · ray-project/ray · GitHub . You could use the Api client directly if you are doing it from a python script/jupyter notebook.

1 Like

Thank you. It would be great if more Python APIs can be provided for the user to monitor ray and ray clusters.

Yes, this is one essential goal of the Ray 2.0

Most of the CLI commands are wrappers on top of python SDKs, so you could use script like below for querying the states as well.

from ray.experimental.state.api import StateApiClient
from ray.experimental.state.common import StateResource

client = StateApiClient()

print(client.list(StateResource.NODES))
print(client.list(StateResource.TASKS))
print(client.list(StateResource.ACTORS))

Or you could use the convenient methods directly:

from ray.experimental.state.api import list_actors

print(list_actors())
1 Like

Great, I will give it a try.