CI / test (push) Successful in 1m28s
Two things a cluster with many nodes and many GPUs needs that were missing, and they are the same thing seen from two distances. Idle tracking. The control plane knew what was placed and whether it was healthy, never whether anyone wanted it — so on a fleet with more models than cards there was no way to answer the first question anyone asks, which is what can I stop. The router is the only thing that knows, so it now reports it: a timestamp written in Acquire, where a request already meets an endpoint under a lock already held, and collected once a tick as a map. That shape is the point. Per-request notification would be a firehose carrying one bit — the newest timestamp wins — and this costs the same on four replicas as on four hundred. It travels through an interface in the direction opposite EndpointSink, for the same reason that one exists: the control plane decides what should run, the router knows whether anyone wants it, and neither should need to be in the other's process to say so. Unknown is kept distinct from idle throughout. A router that has just restarted knows nothing, and a zero timestamp would be the oldest idle replica in every comparison — so one restart would nominate an entire fleet for eviction. Absent from the map, "-" in the table, negative in the JSON, and IdleFor returns a second value rather than a duration anything could act on by mistake. ctl status. A per-node listing is right for four nodes and wrong for two hundred: how full am I, what is broken, what is holding cards nobody is using are aggregates, and reading them off a long table is a chore, which means it gets skipped. Capacity per GPU class with usage bars, free whole nodes per fabric — the number that decides whether a multi-node replica can land, since free cards on the wrong fabric are not capacity for a model that spans nodes — replica and model counts, models that cannot be placed, and what has gone unasked-for. Derived from the same state the tables show, so it cannot disagree with them. Unhealthy GPUs count as neither used nor free, because counting them free is how a cluster looks like it has room it does not. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package cli
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestBarStaysWithinItsWidth(t *testing.T) {
|
|
// It is drawn from counts that can disagree briefly — a GPU freed between
|
|
// two reads — and a bar that overruns its column wrecks the table it is in.
|
|
for _, tc := range [][2]int{{0, 0}, {0, 8}, {8, 8}, {9, 8}, {100, 8}} {
|
|
got := bar(tc[0], tc[1])
|
|
if tc[1] == 0 {
|
|
if got != "" {
|
|
t.Errorf("bar(%d,%d) = %q, want empty for an empty class", tc[0], tc[1], got)
|
|
}
|
|
continue
|
|
}
|
|
if n := strings.Count(got, "#") + strings.Count(got, "."); n != 20 {
|
|
t.Errorf("bar(%d,%d) drew %d cells: %q", tc[0], tc[1], n, got)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestIdleColumnDistinguishesUnknownFromIdle(t *testing.T) {
|
|
// Every replica looks unreported before its first request and after a
|
|
// router restart. Showing that as a very large duration would make an
|
|
// untouched fleet read as an abandoned one.
|
|
if got := idleColumn(-1); got != "-" {
|
|
t.Errorf("idleColumn(-1) = %q, want a dash", got)
|
|
}
|
|
if got := idleColumn(90); got != "1m30s" {
|
|
t.Errorf("idleColumn(90) = %q", got)
|
|
}
|
|
}
|