[WIP] Placement Group API for Python and its mock implementation#8556
[WIP] Placement Group API for Python and its mock implementation#8556yuyiming wants to merge 1 commit intoray-project:masterfrom
Conversation
|
Can one of the admins verify this patch? |
|
Test PASSed. |
| def test_placement_group(ray_start_10_cpus): | ||
| group = ray.experimental.placement_group("test_group")\ | ||
| .set_strategy(PlacementStrategy.SPREAD)\ | ||
| .add_bundle({"CPU": 2.0}).add_bundle({"CPU": 1.0}).create() |
There was a problem hiding this comment.
For python, we probably want these to be kwargs instead of using the builder pattern.
There was a problem hiding this comment.
ray.experimental.placement_group(name="test_group", strategy="spread", bundles=[{"CPU": 2}] * 10)
| @enum.unique | ||
| class PlacementStrategy(enum.Enum): | ||
| PACK = 0 | ||
| SPREAD = 1 |
There was a problem hiding this comment.
For Python we should just use strategy="pack" or strategy="spread" for simplicity, and raise ValueError if the argument is not one of these.
There was a problem hiding this comment.
LGTM. String is much simpler than enumeration.
|
Hi, guys. What's the status for this PR? |
|
Going to close these now that we have the real implementation PR out. |
Documents for Placement Group Design and API:
Work Items
Why are these changes needed?
Python version of Placement API. The previous Java API is in PR #7712.
Related issue number
Checks
scripts/format.shto lint the changes in this PR.