Expand description
Hardware-cluster pin/unpin and hw-component add/delete service logic.
§Model
CSM groups nodes into HSM groups. A parent group holds the
shared pool; a target group represents a sub-pool reserved for a
particular workload. “Pinning” moves nodes from the parent into
the target so that the target satisfies a user-supplied hardware
pattern (e.g. a100:8,milan:2 — eight A100s and two Milan CPUs).
“Unpinning” is the reverse: nodes are released back to the parent.
Both operations are framed as a search over candidate moves where
each candidate is scored by how useful a node is for the target
workload, with a scarcity weighting that prefers giving up common
components and keeping rare ones. See scoring for the rubric.
§Layout
Split into four (private) sub-modules plus shared types:
scoring— pure-computation functions for component scarcity, per-node scoring, candidate selection, pattern parsing, and the parallel hw-inventory fetcher. Also hostsresolve_hw_description_to_xnames, which dispatches between pin and unpin.pin_unpin— thecalculate_target_group_pin/_unpinnode selection algorithms plus the shared coordination helpers used byapply_hw_configuration(pattern parsing, target-group existence check, resource-sufficiency validation, group-update orchestration).apply— high-level coordinators called by the server handlers:apply_hw_configuration,add_hw_component,delete_hw_component.hw_inventory_utils— JSON-pointer helpers that extract memory, processor, and accelerator data from raw HSM inventory payloads.
Public types (AddHwResult, DeleteHwResult, ApplyHwResult,
NodeHwCountVec, HwClusterMode) and shared constants live here
so all sub-modules can use them. The public surface is re-exported
at the bottom of this file; callers (the hw_cluster handlers
under crate::server::handlers) should depend only on those
re-exports.
Structs§
- AddHw
Result - Result of an
add hw-componentoperation. - Apply
HwConfiguration Params - Pin or unpin nodes between
parent_group_nameandtarget_group_nameso the target group satisfiespattern. - Apply
HwResult - Result of an
apply hw-configuration(pin/unpin) operation. - Delete
HwResult - Result of a
delete hw-componentoperation.
Enums§
- HwCluster
Mode - Whether the hw cluster operation moves nodes into the target (Pin) or releases them back (Unpin).
Functions§
- add_
hw_ component - Move enough nodes out of
parent_group_nameintotarget_group_nameto add the components described bypattern(<component>:<delta>pairs) to the target. - apply_
hw_ configuration - Service entry point for
POST /hardware-clusters/{target}/configuration. - delete_
hw_ component - Move enough nodes out of
target_group_nameback intoparent_group_nameto remove the components described bypatternfrom the target.
Type Aliases§
- Node
HwCount Vec - A list of nodes paired with their per-component counts.