# All remote tasks are scheduled to one node

**URL:** <https://discuss.ray.io/t/all-remote-tasks-are-scheduled-to-one-node/3378>\
**Category:** Ray Clusters\
**Created:** [August 28, 2021, 2:32am UTC](https://discuss.ray.io/t/all-remote-tasks-are-scheduled-to-one-node/3378 "2021-08-28T02:32:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blshao84](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/blshao84/32/1010_2.png) [@blshao84](https://discuss.ray.io/u/blshao84)\
**Post date:** [August 28, 2021, 2:32am UTC](https://discuss.ray.io/t/all-remote-tasks-are-scheduled-to-one-node/3378/1 "2021-08-28T02:32:48Z")

</div>

Here’s my ray cluster set up and use case:

1. ray cluster is running on K8s
2. This cluster has a remote python function called ‘calc’
3. In a running pod, I run a Java app invoking ‘calc’ 100 times and waiting for their completion.
4. The code snippet in Java is like below:

```auto
 fun rpcCollect(jobIds: List<String>) {
        Ray.init()
        val tasks = batches.map {
            ....
            Ray.task(PyFunction.of("pricer", "calc", String::class.java), data).remote()
        }
        ....
        val results = Ray.get(tasks).map {...) }
        ...
    }

```

1. The jvm args for Ray.init is something like this:  
export JAVA\_OPTS=’-Dray.address=ray\_head:6379 -Dray.job.code-search-path=…’, in which ray\_head is the ip of the head node of my cluster.

When I run my java app, what I observed from Ray Dashboard is that all tasks are scheduled to one node, which my java app runs on. However, instead of calling ‘calc’ from Java, if I invoke it from python, tasks are sent to different nodes as expected.

Any suggestions?
