Facility-aware placement: racks, PDUs, holds and power caps
Nodes say where they are with llmgw.io/site, room, row, rack and pdu labels, from agent.yaml or `llmgw ctl label` (kept in the store, over the agent's). Placement spreads a model's replicas across racks and PDUs, keeps a multi-node replica within one domain when its profile says keep_within, places nothing in a domain held with `llmgw ctl facility hold` (optionally draining it), and refuses a shard that would take a domain past its power cap from facility.budgets, counting declared, derived and measured draw. Explain-placement names the domain, and keeps the rejections of a placed replica; `ctl nodes` gains LOCATION and --domain; `ctl facility` lists the domains; the console's Nodes view shows and sets location and holds. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d41104a452
commit
0d3eb82b9b
42 files changed
+3510
-63
No files matched your search
+19
-1
@@ -6,6 +6,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/control/adminapi"
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/control/facility"
|
||||
)
|
||||
|
||||
// nodeFilter narrows a node listing.
|
||||
@@ -20,6 +21,8 @@ type nodeFilter struct {
|
||||
class string
|
||||
state string
|
||||
labels []string
|
||||
// domain is level:name, rack:r12-07.
|
||||
domain string
|
||||
}
|
||||
|
||||
// empty reports whether this filter would narrow anything.
|
||||
@@ -28,7 +31,7 @@ type nodeFilter struct {
|
||||
// different situations with different next steps, and "no nodes" for both
|
||||
// makes a mistyped fabric look like an outage.
|
||||
func (f nodeFilter) empty() bool {
|
||||
return f.fabric == "" && f.class == "" && f.state == "" && len(f.labels) == 0
|
||||
return f.fabric == "" && f.class == "" && f.state == "" && len(f.labels) == 0 && f.domain == ""
|
||||
}
|
||||
|
||||
func (f nodeFilter) describe() string {
|
||||
@@ -45,6 +48,9 @@ func (f nodeFilter) describe() string {
|
||||
for _, l := range f.labels {
|
||||
parts = append(parts, "label "+l)
|
||||
}
|
||||
if f.domain != "" {
|
||||
parts = append(parts, "domain "+f.domain)
|
||||
}
|
||||
return strings.Join(parts, ", ")
|
||||
}
|
||||
|
||||
@@ -62,11 +68,23 @@ func (f nodeFilter) apply(in []adminapi.NodeView) ([]adminapi.NodeView, error) {
|
||||
want[k] = v
|
||||
}
|
||||
|
||||
var domain facility.Domain
|
||||
if f.domain != "" {
|
||||
d, err := facility.ParseDomain(f.domain)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("--domain: %w", err)
|
||||
}
|
||||
domain = d
|
||||
}
|
||||
|
||||
out := make([]adminapi.NodeView, 0, len(in))
|
||||
for _, n := range in {
|
||||
if f.fabric != "" && !slices.Contains(n.Fabrics, f.fabric) {
|
||||
continue
|
||||
}
|
||||
if domain != "" && (n.Location == nil || !slices.Contains(n.Location.Domains(), domain)) {
|
||||
continue
|
||||
}
|
||||
if f.class != "" && !slices.Contains(n.Classes, f.class) {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user