-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[core] [1/2] Topology aware scheduling public API #63479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 20 commits
048f2ae
b39025b
1b96c6f
141bdaf
9e7d9af
ba7f43f
b0e8f85
5b8979f
972ca0e
88364be
734fcbf
6d3a742
867b20b
016361c
7c6a2b9
17f8a35
627688d
0db8536
e5afe1f
27cba4f
e49ae4f
dc20d13
1f675bb
e60213e
dda9bab
e8c530d
093469f
2aeea5e
fb280df
7a52b43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -712,6 +712,17 @@ cdef int prepare_actor_concurrency_groups( | |
| return 1 | ||
|
|
||
|
|
||
| cdef CPlacementStrategy prepare_c_strategy(c_string strategy) except *: | ||
| if strategy == b"PACK": | ||
| return PLACEMENT_STRATEGY_PACK | ||
| elif strategy == b"SPREAD": | ||
| return PLACEMENT_STRATEGY_SPREAD | ||
| elif strategy == b"STRICT_PACK": | ||
| return PLACEMENT_STRATEGY_STRICT_PACK | ||
| else: | ||
| return PLACEMENT_STRATEGY_STRICT_SPREAD | ||
|
|
||
|
|
||
| def raise_sys_exit_with_custom_error_message( | ||
| ray_terminate_msg: str, | ||
| exit_code: int = 0) -> None: | ||
|
|
@@ -3671,23 +3682,22 @@ cdef class CoreWorker: | |
| c_string strategy, | ||
| c_bool is_detached, | ||
| soft_target_node_id, | ||
| c_vector[unordered_map[c_string, c_string]] bundle_label_selector): | ||
| c_vector[unordered_map[c_string, c_string]] bundle_label_selector, | ||
| topology_strategy): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to make the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| cdef: | ||
| CPlacementGroupID c_placement_group_id | ||
| CPlacementStrategy c_strategy | ||
| CNodeID c_soft_target_node_id = CNodeID.Nil() | ||
| c_vector[unordered_map[c_string, CPlacementStrategy]] c_topology_strategy | ||
| unordered_map[c_string, CPlacementStrategy] c_level | ||
|
|
||
| if strategy == b"PACK": | ||
| c_strategy = PLACEMENT_STRATEGY_PACK | ||
| elif strategy == b"SPREAD": | ||
| c_strategy = PLACEMENT_STRATEGY_SPREAD | ||
| elif strategy == b"STRICT_PACK": | ||
| c_strategy = PLACEMENT_STRATEGY_STRICT_PACK | ||
| else: | ||
| if strategy == b"STRICT_SPREAD": | ||
| c_strategy = PLACEMENT_STRATEGY_STRICT_SPREAD | ||
| else: | ||
| raise TypeError(strategy) | ||
| c_strategy = prepare_c_strategy(strategy) | ||
|
|
||
| for level in topology_strategy: | ||
| c_level.clear() | ||
| for label, level_strategy in level.items(): | ||
| c_level[label] = prepare_c_strategy(level_strategy) | ||
| c_topology_strategy.push_back(c_level) | ||
|
|
||
| if soft_target_node_id is not None: | ||
| c_soft_target_node_id = CNodeID.FromHex(soft_target_node_id) | ||
|
|
@@ -3702,7 +3712,8 @@ cdef class CoreWorker: | |
| bundles, | ||
| is_detached, | ||
| c_soft_target_node_id, | ||
| bundle_label_selector), | ||
| bundle_label_selector, | ||
| c_topology_strategy), | ||
| &c_placement_group_id)) | ||
|
|
||
| return PlacementGroupID(c_placement_group_id.Binary()) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,7 +89,7 @@ const PlacementGroupTable = ({ | |
| { label: "State" }, | ||
| { label: "Reserved Resources" }, | ||
| { label: "Label Selector" }, | ||
| { label: "Label Domain" }, | ||
| { label: "Topology" }, | ||
| { label: "Scheduling Detail" }, | ||
| ]; | ||
|
|
||
|
|
@@ -194,8 +194,8 @@ const PlacementGroupTable = ({ | |
| state, | ||
| stats, | ||
| bundles, | ||
| label_domain_key, | ||
| label_domain_assignments, | ||
| topology_strategy, | ||
| topology_assignments, | ||
| }) => ( | ||
| <TableRow key={placement_group_id}> | ||
| <TableCell align="center"> | ||
|
|
@@ -215,16 +215,22 @@ const PlacementGroupTable = ({ | |
| <LabelSelector bundles={bundles} /> | ||
| </TableCell> | ||
| <TableCell align="center"> | ||
| {label_domain_key ? ( | ||
| {topology_strategy ? ( | ||
| <Box sx={{ textAlign: "left" }}> | ||
| <div> | ||
| <b>key:</b> {label_domain_key} | ||
| <b>strategy:</b>{" "} | ||
| {JSON.stringify(topology_strategy[0].entries)} | ||
|
aaronscalene marked this conversation as resolved.
Outdated
|
||
| </div> | ||
| <div> | ||
| <b>assignment:</b>{" "} | ||
| {label_domain_assignments && | ||
| Object.keys(label_domain_assignments).length > 0 | ||
| ? JSON.stringify(label_domain_assignments) | ||
|
aaronlinear marked this conversation as resolved.
|
||
| {topology_assignments && | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: same comment here as above
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, missed this. Done. |
||
| topology_assignments.length > 0 && | ||
| topology_assignments[0].assignments && | ||
| Object.keys(topology_assignments[0].assignments) | ||
| .length > 0 | ||
| ? JSON.stringify( | ||
| topology_assignments[0].assignments, | ||
| ) | ||
| : "-"} | ||
| </div> | ||
| </Box> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.