Hi there,
Is it possible to use Placement Group in Ray?
I have a cost-saving set-up for a Ray cluster(on K8s).
rayHeadType:
CPU: 4
memory: 32Gi
GPU: 0
rayResources: { "CPU": 0 }
nodeSelector: {}
rayWorkerType:
minWorkers: 0
maxWorkers: 6
memory: 32Gi
CPU: 4
GPU: 0
rayResources: {}
nodeSelector: {}
Therefore, when I connected to the Ray cluster the available resources would be something like this which is expected.
{'node:10.160.5.2': 1.0, 'memory': 22548578304.0, 'object_store_memory': 9597968707.0}
However, when I tried to use Modin on the connected Ray cluster, it shows
Traceback (most recent call last):
File "tmp.py", line 20, in <module>
df = pd.read_parquet("gs://xxx/xxx/xxx.parquet")
File "/home/jovyan/ray/lib/python3.8/site-packages/modin/pandas/io.py", line 222, in read_parquet
Engine.subscribe(_update_engine)
File "/home/jovyan/ray/lib/python3.8/site-packages/modin/config/pubsub.py", line 213, in subscribe
callback(cls)
File "/home/jovyan/ray/lib/python3.8/site-packages/modin/pandas/__init__.py", line 124, in _update_engine
initialize_ray()
File "/home/jovyan/ray/lib/python3.8/site-packages/modin/core/execution/ray/common/utils.py", line 200, in initialize_ray
num_cpus = int(ray.cluster_resources()["CPU"])
KeyError: 'CPU'
It’s understandable, Modin may calculate the num of cpus depending on the Ray cluster’s current resource.
For now, my silly workaround was using a small remote function to force the Ray cluster to scale up to at least one worker node before I used Modin.
@ray.remote
def silly():
from time import sleep
sleep(5)
So, according to this scenario, Is it possible to use Placement Group in Ray?