[Core] Programmatic way to access pending tasks for an actor?

The Ray Dashboard has a nice field “Number of pending tasks” for each Actor which can indicate if the actor is a bottleneck if the value keeps increasing.

I’d like to programmatically access this but currently don’t see how, something along the lines of

@ray.remote
class MyActor:
    def task(self):
        while True:
            pass # block forerver
    
actor_ref = MyActor.remote()
actor_ref.task.remote()
actor_ref.pending_tasks() #--> 1
actor_ref.task.remote()
actor_ref.pending_tasks() #--> 2

This is a neat feature request!

@ericl @sangcho any thoughts on this?

I think we can potentially support something like actor_handle.stats that show the same information as the dashboard? Can you create a feature request? Also cc @eoakes

That would be great @sangcho. Where should I create the future request? On Github it says “For feature requests or questions, post on our Discussion page instead: https://discuss.ray.io/

Hmm @rliaw where’s the official place to have a feature request?

Ah, I think we should definitely track things that we plan to do on Github (backlog).

Discuss.ray.io is good for discussing/validating feature requests.

Thanks! Requested: [Core] Programmatic way to access pending tasks for an actor? · Issue #16641 · ray-project/ray · GitHub