mirror of
https://github.com/wassname/ray.git
synced 2026-07-28 11:25:04 +08:00
Allow tasks to be used with placement groups (#9738)
This commit is contained in:
@@ -4,7 +4,7 @@ from typing import (List, Dict)
|
||||
|
||||
def placement_group(bundles: List[Dict[str, float]],
|
||||
strategy: str = "PACK",
|
||||
name: str = None):
|
||||
name: str = "unnamed_group"):
|
||||
"""
|
||||
Create a placement group.
|
||||
|
||||
@@ -21,6 +21,13 @@ def placement_group(bundles: List[Dict[str, float]],
|
||||
name: The name of the placement group.
|
||||
"""
|
||||
worker = ray.worker.global_worker
|
||||
worker.check_connected()
|
||||
|
||||
if not isinstance(bundles, list):
|
||||
raise ValueError(
|
||||
"The type of bundles must be list, got {}".format(bundles))
|
||||
|
||||
placement_group_id = worker.core_worker.create_placement_group(
|
||||
name, bundles, strategy)
|
||||
|
||||
return placement_group_id
|
||||
|
||||
Reference in New Issue
Block a user