# Submit remote work to a specific worker

**URL:** <https://discuss.ray.io/t/submit-remote-work-to-a-specific-worker/11935>\
**Category:** Ray Core\
**Created:** [August 24, 2023, 7:07pm UTC](https://discuss.ray.io/t/submit-remote-work-to-a-specific-worker/11935 "2023-08-24T19:07:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![esaliya](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/esaliya/32/4978_2.png) [@esaliya](https://discuss.ray.io/u/esaliya)\
**Post date:** [August 24, 2023, 7:07pm UTC](https://discuss.ray.io/t/submit-remote-work-to-a-specific-worker/11935/1 "2023-08-24T19:07:38Z")

</div>

**How severe does this issue affect your experience of using Ray?**

- High: It blocks me to complete my task.

I am trying to ray workers, each one for a specific GPU. Say there are 4 GPUs, and I would like each ay worker to specifically submit work to one of these.

So from the client script, if there’s some remote work, how to schedule the work on to a specific worker?

Thank you

---

<div class="post-metadata">

**Author:** ![Jules\_Damji](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/jules_damji/32/4058_2.png) [@Jules\_Damji](https://discuss.ray.io/u/Jules_Damji)\
**Post date:** [August 24, 2023, 8:42pm UTC](https://discuss.ray.io/t/submit-remote-work-to-a-specific-worker/11935/2 "2023-08-24T20:42:56Z")

</div>

@esaliya You can use [placement groups](https://docs.ray.io/en/latest/ray-core/scheduling/placement-group.html#schedule-tasks-and-actors-to-placement-groups-use-reserved-resources) with appropriate resources so that tasks are assigned placegroups, and workers on nodes that satisfy the placement group resources will be assigned that task.

You can read about the different scheduling techniques and the placement group concepts [here](https://docs.ray.io/en/latest/ray-core/scheduling/placement-group.html#placement-groups).

---

<div class="post-metadata">

**Author:** ![esaliya](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/esaliya/32/4978_2.png) [@esaliya](https://discuss.ray.io/u/esaliya)\
**Post date:** [August 24, 2023, 8:59pm UTC](https://discuss.ray.io/t/submit-remote-work-to-a-specific-worker/11935/3 "2023-08-24T20:59:52Z")

</div>

Thanks Jules. I looked at placement groups. I was not clear how I could keep a dedicated worker for a specific GPU. In this example all 4 GPUs are identical, so resources wise they’ll be the same. However, I want remote task _i_ to be sent to worker _i_.

Is this something possible?

---

<div class="post-metadata">

**Author:** ![Jules\_Damji](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/jules_damji/32/4058_2.png) [@Jules\_Damji](https://discuss.ray.io/u/Jules_Damji)\
**Post date:** [August 24, 2023, 9:19pm UTC](https://discuss.ray.io/t/submit-remote-work-to-a-specific-worker/11935/4 "2023-08-24T21:19:39Z")

</div>

@esaliya Unless you a cluster with only one worker that has all the GPUs and others none, and specify your placement group, then each task assigned the placement group will only be scheduled to the node with 4 GPUs. You probably, then, won’t parallelize it since the scheduler can only schedule a single task that meets that requirement; others will be queue.

cc: @jjyao Is this possible what he’s asking?

---

<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:** [August 25, 2023, 1:58pm UTC](https://discuss.ray.io/t/submit-remote-work-to-a-specific-worker/11935/5 "2023-08-25T13:58:54Z")

</div>

I think the best way is to create actors and you remember some index → actor mapping to send actor task (i.e., rank)

---

<div class="post-metadata">

**Author:** ![Jules\_Damji](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/jules_damji/32/4058_2.png) [@Jules\_Damji](https://discuss.ray.io/u/Jules_Damji)\
**Post date:** [August 25, 2023, 6:54pm UTC](https://discuss.ray.io/t/submit-remote-work-to-a-specific-worker/11935/6 "2023-08-25T18:54:30Z")

</div>

@sangcho Do you want to elaborate, may be, with a short or small example? Thanks!

---

<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:** [August 28, 2023, 4:15am UTC](https://discuss.ray.io/t/submit-remote-work-to-a-specific-worker/11935/7 "2023-08-28T04:15:07Z")

</div>

```plaintext
actors = [Actor.options(num_gpus=1, name=f"rank_{i}").remote() for i in range(10)]

# You can get a specific actor using name
actor = ray.get_actor(name="rank_0")

```

---

<div class="post-metadata">

**Author:** ![esaliya](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/esaliya/32/4978_2.png) [@esaliya](https://discuss.ray.io/u/esaliya)\
**Post date:** [September 8, 2023, 6:09pm UTC](https://discuss.ray.io/t/submit-remote-work-to-a-specific-worker/11935/8 "2023-09-08T18:09:55Z")

</div>

Thanks @sangcho, but I am a little unclear how to follow your example. Here’s a simplified example of my use case. As shown, I want to invoke task 1 specifically in rank 0 and task 2 in rank 1. Could this be done? I use ranks here to identify workers in the Ray clusters

 ![image](https://us1.discourse-cdn.com/flex020/uploads/ray/original/2X/8/8c505db747b2af7f0f77022564515047ce753f65.png)

---

<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:** [September 26, 2023, 9:09pm UTC](https://discuss.ray.io/t/submit-remote-work-to-a-specific-worker/11935/9 "2023-09-26T21:09:52Z")

</div>

```plaintext
class Scheduler:
    def __init__ (self):
        self.workers = {
           "0": Actor.options(name="rank_0").remote(),
           "1": Actor.options(name="rank_1").remote()
       }
    def call(self, rank):
        self.workers[rank].function.remote()

```

something like this?
