[placement group] Can not create pg for fractional resources
See original GitHub issueWhat is the problem?
I try to create a placement group with specific node ip as resources. I used Ray 2.0.0-dev, python 3.8.3, and tried with two ways, neither works.
First is directly creating the pg, and assuming the ray cluster_resources already has the node ip resource
import ray
from ray.util.placement_group import (
placement_group,
placement_group_table,
remove_placement_group
)
ray.init()
ray.cluster_resources() # this will print {'node:192.168.1.5': 1.0, 'CPU': 12.0, 'memory': 232.0, 'object_store_memory': 80.0}
ray.state.current_node_id() # this will print 'node:192.168.1.5'
#creating the pg with ip as the resource bundle
pg=placement_group([{ray.state.current_node_id():0.01}])
ray.get(pg.ready()) # code will stuck here, never return
second is to init ray with the custom resources
import ray
from ray.util.placement_group import (
placement_group,
placement_group_table,
remove_placement_group
)
ray.init(resources={'node:192.168.1.5':1.0})
pg=placement_group([{'node:192.168.1.5':0.01}])
ray.get(pg.ready()) # code will stuck here too.
Ray version and other system information (Python version, TensorFlow version, OS): ray 2.0.0.dev0, python 3.8.3, os Darwin Kernel Version 19.6.0
Reproduction (REQUIRED)
Please provide a short code snippet (less than 50 lines if possible) that can be copy-pasted to reproduce the issue. The snippet should have no external library dependencies (i.e., use fake or mock data / environments): Attached above. If the code snippet cannot be run by itself, the issue will be closed with “needs-repro-script”.
- I have verified my script runs in a clean environment and reproduces the issue.
- I have verified the issue also occurs with the latest wheels.
Issue Analytics
- State:
- Created 3 years ago
- Comments:22 (22 by maintainers)
Also I can confirm this bug exists on master.
@richardliaw Ohhh yes good catch. That fixes the problem.