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

**URL:** <https://discuss.ray.io/t/core-programmatic-way-to-access-pending-tasks-for-an-actor/2387>\
**Category:** Ray Core\
**Created:** [June 2, 2021, 6:34pm UTC](https://discuss.ray.io/t/core-programmatic-way-to-access-pending-tasks-for-an-actor/2387 "2021-06-02T18:34:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpayne](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/cpayne/32/952_2.png) [@cpayne](https://discuss.ray.io/u/cpayne)\
**Post date:** [June 2, 2021, 6:34pm UTC](https://discuss.ray.io/t/core-programmatic-way-to-access-pending-tasks-for-an-actor/2387/1 "2021-06-02T18:34:55Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![rliaw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rliaw/32/24_2.png) [@rliaw](https://discuss.ray.io/u/rliaw)\
**Post date:** [June 4, 2021, 8:01am UTC](https://discuss.ray.io/t/core-programmatic-way-to-access-pending-tasks-for-an-actor/2387/2 "2021-06-04T08:01:11Z")

</div>

This is a neat feature request!

@ericl @sangcho any thoughts on this?

---

<div class="post-metadata">

**Author:** ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)\
**Post date:** [June 4, 2021, 4:33pm UTC](https://discuss.ray.io/t/core-programmatic-way-to-access-pending-tasks-for-an-actor/2387/3 "2021-06-04T16:33:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cpayne](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/cpayne/32/952_2.png) [@cpayne](https://discuss.ray.io/u/cpayne)\
**Post date:** [June 4, 2021, 5:12pm UTC](https://discuss.ray.io/t/core-programmatic-way-to-access-pending-tasks-for-an-actor/2387/4 "2021-06-04T17:12:53Z")

</div>

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/](https://discuss.ray.io/)”

---

<div class="post-metadata">

**Author:** ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)\
**Post date:** [June 8, 2021, 9:13am UTC](https://discuss.ray.io/t/core-programmatic-way-to-access-pending-tasks-for-an-actor/2387/5 "2021-06-08T09:13:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rliaw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rliaw/32/24_2.png) [@rliaw](https://discuss.ray.io/u/rliaw)\
**Post date:** [June 20, 2021, 7:50am UTC](https://discuss.ray.io/t/core-programmatic-way-to-access-pending-tasks-for-an-actor/2387/6 "2021-06-20T07:50:55Z")

</div>

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

[Discuss.ray.io](http://Discuss.ray.io) is good for discussing/validating feature requests.

---

<div class="post-metadata">

**Author:** ![cpayne](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/cpayne/32/952_2.png) [@cpayne](https://discuss.ray.io/u/cpayne)\
**Post date:** [June 23, 2021, 8:24pm UTC](https://discuss.ray.io/t/core-programmatic-way-to-access-pending-tasks-for-an-actor/2387/7 "2021-06-23T20:24:51Z")

</div>

Thanks! Requested: [[Core] Programmatic way to access pending tasks for an actor? · Issue #16641 · ray-project/ray · GitHub](https://github.com/ray-project/ray/issues/16641)
