# How to make sure actors are triggered on the same set of hosts?

**URL:** <https://discuss.ray.io/t/how-to-make-sure-actors-are-triggered-on-the-same-set-of-hosts/22137>\
**Category:** Uncategorized\
**Created:** [March 25, 2025, 8:56pm UTC](https://discuss.ray.io/t/how-to-make-sure-actors-are-triggered-on-the-same-set-of-hosts/22137 "2025-03-25T20:56:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Monil](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@Monil](https://discuss.ray.io/u/Monil)\
**Post date:** [March 25, 2025, 8:56pm UTC](https://discuss.ray.io/t/how-to-make-sure-actors-are-triggered-on-the-same-set-of-hosts/22137/1 "2025-03-25T20:56:27Z")

</div>

I have a ray cluster and I have an actor that does some inference work. This actor A keeps adding metadata onto local file system. I want to trigger another actor B that keeps reading the metadata and push it to storage. How do I make sure actor B gets triggered on same nodes where A is running?

---

<div class="post-metadata">

**Author:** ![christina](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/christina/32/7542_2.png) [@christina](https://discuss.ray.io/u/christina)\
**Post date:** [March 28, 2025, 1:53am UTC](https://discuss.ray.io/t/how-to-make-sure-actors-are-triggered-on-the-same-set-of-hosts/22137/2 "2025-03-28T01:53:19Z")

</div>

Hello Monil and welcome to the Ray community!

So I think what might help here is something called `NodeAffinitySchedulingStrategy` which can help Actor B be triggered on the same node where Actor A is running. This strategy allows you to specify that an actor should be scheduled on a particular node. If you know the node ID of Node A then this should be possible.

> [`NodeAffinitySchedulingStrategy`](https://docs.ray.io/en/latest/ray-core/api/doc/ray.util.scheduling_strategies.NodeAffinitySchedulingStrategy.html#ray.util.scheduling_strategies.NodeAffinitySchedulingStrategy) is a low-level strategy that allows a task or actor to be scheduled onto a particular node specified by its node id.

Here’s some docs where you can read up more on it:

- [User Guides — Ray 2.44.1](https://docs.ray.io/en/latest/ray-core/user-guide.html#user-guides)
- [Actors — Ray 2.44.1](https://docs.ray.io/en/latest/ray-core/actors.html#scheduling)
- [Scheduling — Ray 2.44.1](https://docs.ray.io/en/latest/ray-core/scheduling/index.html#nodeaffinityschedulingstrategy)

Let me know if this is helpful for your use case !
