aiinfra-tools 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,64 @@
3
3
  All notable changes. Versions follow [Semantic Versioning](https://semver.org/); before 1.0, a minor version may
4
4
  change the `--json` output, and when it does the change is listed here (see [schemas/](schemas/README.md)).
5
5
 
6
+ ## 0.4.0 (2026-11-29)
7
+
8
+ The services now deploy anywhere with one command, and the catalog is current. `deploy/cloud/up.sh` puts fleetops,
9
+ Grafana and the FleetScope and Inference Sizer pages on Google Cloud, AWS, Azure, a neocloud's Kubernetes, on-prem or a
10
+ single GPU server, and hybrid fleets send every site's GPU metrics to one hub. The sizer and FleetScope know the 2026
11
+ open-weight models and the attention they use, and Vera Rubin, MI455X and RTX PRO 6000. No `--json` output changed.
12
+
13
+ - **Deploy anywhere:** one Helm chart, `up.sh gcp | aws | azure | k8s | vm` and `down.sh`, Terraform for each cloud and
14
+ for existing clusters, container images for x86 and Arm (#83). See [docs/DEPLOY.md](docs/DEPLOY.md).
15
+ - **Hybrid fleets:** a site joins a hub with `--site NAME --hub URL`; fleetops records which site each record came from.
16
+ - **Models and hardware:** Kimi K3, DeepSeek V4, GLM-5.x, Qwen3.5 and 3.8, MiniMax M3, Gemma 4 and more; linear,
17
+ compressed and sparse attention in the sizer; a weekly task proposes catalog updates (#80).
18
+ - **AgentX validation** reads InferenceX's real model prefixes and GPU names (#81).
19
+ - **Not yet run on a real cloud:** CI installs a hub and a second site on a local kind cluster; the first GKE, EKS and AKS
20
+ runs will be recorded in [docs/RESULTS.md](docs/RESULTS.md).
21
+
22
+ ### New: deploy anywhere — clouds, neoclouds, on-prem and hybrid
23
+
24
+ - **One Helm chart** (`deploy/helm/aiinfratools`) for the service stack: fleetops, Grafana with the dashboard
25
+ provisioned, the FleetScope and Inference Sizer pages, and a collector (Prometheus in agent mode) that finds the GPU
26
+ exporters on the cluster and sends their series to fleetops. Hub mode runs everything; site mode runs only the
27
+ collector.
28
+ - **One command per target:** `deploy/cloud/up.sh gcp | aws | azure | k8s | vm` makes a GKE Autopilot, EKS Auto Mode or
29
+ AKS cluster when missing, or uses the cluster kubectl points at (neocloud, on-prem), or Docker on one machine.
30
+ `down.sh` removes it, the store's disk first so no cloud disk keeps billing. Google Cloud Shell has a button and a
31
+ walkthrough.
32
+ - **Hybrid fleets:** sites join a hub with `up.sh k8s|vm --site NAME --hub URL`; fleetops ingest takes a per-request
33
+ site from the `X-Fleetops-Site` header, so records say where they came from.
34
+ - **Terraform** for Google, AWS, Azure and existing clusters, through one shared module.
35
+ - **Images** for linux/amd64 and arm64 on GitHub's container registry, pushed from main and releases.
36
+ - **GPU model on any cloud:** fleetops' preflight reads it from GPU Feature Discovery, GKE's label or the instance type,
37
+ and the instance table now has Azure's ND H100/H200/MI300X v5, ND GB200 v6 and ND A100 v4 sizes.
38
+ - CI lints and renders the chart for every platform, validates the Terraform, and installs a hub and a second site on
39
+ kind to check that records arrive tagged by site. See [docs/DEPLOY.md](docs/DEPLOY.md).
40
+
41
+ ### New: models and hardware, current as of November 2026
42
+
43
+ - **Models:** Kimi K3 / K3.1 Pro, Kimi K2.6, DeepSeek-V4-Pro and V4-Flash, GLM-5.1 and GLM-5.3, Mistral Large 4,
44
+ Qwen3.5-397B and Qwen3.8 27B, MiniMax M3 and M2.7, Muse Spark Open and Gemma 4 31B join the Inference Sizer's catalog.
45
+ FleetScope's model menus now list the whole catalog, not five models.
46
+ - **Attention the sizer models:** linear-attention layers with a fixed state per sequence (`linFrac`, `linStateMB`),
47
+ compressed KV (`kvKeep`) and sparse attention (`sparseTopK`). Hugging Face configs with Gated DeltaNet layers or an
48
+ index top-k import with them. A model without these fields sizes exactly as before.
49
+ - **Hardware:** NVIDIA Vera Rubin NVL72, AMD Instinct MI455X (Helios) and NVIDIA RTX PRO 6000 Blackwell Server join the
50
+ accelerator registry, so they reach the sizer, FleetScope, fleetops' power model and telemetry matching.
51
+ - **AgentX validation reads InferenceX's own model prefixes** (`dsv4`, `kimik3.1`, `glm5.3`, `minimaxm3`, `musespark`,
52
+ `qwen3.5`, `gptoss`…), plus A100, Vera Rubin, MI455X and cloud-suffixed GPU names (`b200-nscale`). Models the sizer
53
+ can't size yet are counted as skipped, not read as a shorter prefix.
54
+ - **Kept current weekly:** `inference-sizer/docs/CATALOG.md` says where figures come from and how to add a model or a
55
+ chip, and lists what isn't in yet and why (Trainium3, TPU 8, DeepSeek V4.1 Flash). A weekly scheduled task follows it
56
+ and opens a pull request.
57
+
58
+ ### Fixed
59
+
60
+ - **Live test kit (`fleetops/deploy/shadow-live`):** the engines get 40 minutes to start instead of Kubernetes'
61
+ 10-minute default, which a first start on fresh GPU nodes (pulling the vLLM image, fetching the model) can pass. A
62
+ failed run writes `out/diag.txt` (pods, events, GPUs per node, engine logs) before cleaning up (#82).
63
+
6
64
  ## 0.3.0 (2026-11-26)
7
65
 
8
66
  The loop now covers what a change costs, not only whether it works. There is a new tool for agent harnesses
package/README.md CHANGED
@@ -37,6 +37,19 @@ npx aiinfra-tools sizer --model llama33-70b --gpu H100 # or: npm i -g aiinfra
37
37
  Every command takes `--json`; the output of the ones agents rely on is described by [JSON Schemas](schemas/README.md). Or open the repository in a Codespace ([.devcontainer](.devcontainer/devcontainer.json)): `aiinfra` is ready on the path. The package also installs each tool's own command (`fleetops`, `gpu-health`, `gpu-ledger`, `harness-ledger`, `inference-sizer`,
38
38
  `fleetscope`, `fix-skew`). Or clone the repository and run any tool from its folder.
39
39
 
40
+ ## Deploy the services
41
+
42
+ fleetops, Grafana and the FleetScope and Inference Sizer pages, on Google Cloud, AWS, Azure, a neocloud's Kubernetes,
43
+ on-prem or a single GPU server, in one command; hybrid fleets send every site's GPU metrics to one hub. Terraform too.
44
+ See [docs/DEPLOY.md](docs/DEPLOY.md).
45
+
46
+ ```bash
47
+ deploy/cloud/up.sh gcp | aws | azure | k8s | vm # a hub
48
+ deploy/cloud/up.sh k8s --site onprem-sd --hub https://fleetops.example.com # a site joining it
49
+ ```
50
+
51
+ [![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://shell.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fhardikashah-eng%2FAIInfraTools&cloudshell_tutorial=deploy%2Fcloud%2FTUTORIAL-gcp.md&shellonly=true)
52
+
40
53
  ## The loop in one command
41
54
 
42
55
  `aiinfra demo` runs Observe → Diagnose → Simulate → Approve → Optimize → Verify on one real week of the Microsoft
@@ -29,5 +29,13 @@ deploy/shadow-live/run.sh --yes # send the traffic; the namespace is deleted
29
29
  Results land in `deploy/shadow-live/out/`: `paired-verdict.txt`, `canary-verdict.txt`, `judge.json`, and
30
30
  `canary-series.json` (the Prometheus series, to rerun with `fleetops shadow prom --file`).
31
31
 
32
+ If a step fails, `out/diag.txt` holds the pods, recent events, GPU counts per node and the engines' last log lines.
33
+ The first start is slow: each node pulls the vLLM image (several GB) and the model before the engine starts, so the
34
+ engine Deployments allow 40 minutes to become ready rather than Kubernetes' 10-minute default.
35
+
36
+ On GKE, the L4 nodes carry `cloud.google.com/gke-accelerator=nvidia-l4` but not the label above; add it with
37
+ `kubectl label nodes -l cloud.google.com/gke-accelerator=nvidia-l4 nvidia.com/gpu.product=NVIDIA-L4`. Create the GPU node
38
+ pool with `--accelerator type=nvidia-l4,count=1,gpu-driver-version=latest` so the driver is installed for you.
39
+
32
40
  For an engine upgrade instead of a known change, set `chat-v2`'s image to the new vLLM version and drop
33
41
  `--no-enable-prefix-caching`; there the verdict is what you want to learn.
@@ -14,6 +14,7 @@ kind: Deployment
14
14
  metadata: { name: chat-v1, namespace: shadow-live }
15
15
  spec:
16
16
  replicas: 2
17
+ progressDeadlineSeconds: 2400 # pulling the vLLM image, fetching the model and starting the engine can pass the 10-minute default
17
18
  selector: { matchLabels: { app.kubernetes.io/name: chat-v1 } }
18
19
  template:
19
20
  metadata: { labels: { app: chat, app.kubernetes.io/name: chat-v1 } }
@@ -34,6 +35,7 @@ kind: Deployment
34
35
  metadata: { name: chat-v2, namespace: shadow-live }
35
36
  spec:
36
37
  replicas: 1
38
+ progressDeadlineSeconds: 2400 # pulling the vLLM image, fetching the model and starting the engine can pass the 10-minute default
37
39
  selector: { matchLabels: { app.kubernetes.io/name: chat-v2 } }
38
40
  template:
39
41
  metadata: { labels: { app: chat, app.kubernetes.io/name: chat-v2 } }
@@ -9,7 +9,12 @@ here="$(cd "$(dirname "$0")" && pwd)"; repo="$(cd "$here/../../.." && pwd)"; out
9
9
  F=(node "$repo/fleetops/tools/fleetops.mjs"); A=(node "$repo/fleetscope/tools/agentic.mjs")
10
10
  live=""; keep=""; for a in "$@"; do case "$a" in --yes) live="--live";; --keep) keep=1;; *) echo "unknown argument $a" >&2; exit 2;; esac; done
11
11
  mkdir -p "$out"; NS=(-n shadow-live); PIDS=()
12
- cleanup() { for p in "${PIDS[@]}"; do kill "$p" 2>/dev/null || true; done; if [ -z "$keep" ] && [ -n "$live" ]; then kubectl delete -f "$here/kit.yaml" --ignore-not-found --wait=false; fi; }
12
+ diag() { # what a failed step needs to be read: pods, recent events, nodes and the engines' last log lines
13
+ { kubectl "${NS[@]}" get pods -o wide; echo; kubectl "${NS[@]}" get events --sort-by=.lastTimestamp | tail -40; echo
14
+ kubectl get nodes -l nvidia.com/gpu.product=NVIDIA-L4 -o custom-columns=NODE:.metadata.name,GPUS:.status.allocatable.nvidia\.com/gpu; echo
15
+ for d in chat-v1 chat-v2; do echo "-- $d"; kubectl "${NS[@]}" describe deploy "$d" | tail -15; kubectl "${NS[@]}" logs "deploy/$d" --tail=40 2>&1 || true; done
16
+ } > "$out/diag.txt" 2>&1 || true; echo "diagnostics written to $out/diag.txt" >&2; }
17
+ cleanup() { rc=$?; [ "$rc" -eq 0 ] || diag; for p in "${PIDS[@]}"; do kill "$p" 2>/dev/null || true; done; if [ -z "$keep" ] && [ -n "$live" ]; then kubectl delete -f "$here/kit.yaml" --ignore-not-found --wait=false; fi; }
13
18
  trap cleanup EXIT
14
19
 
15
20
  n=$(kubectl get nodes -l nvidia.com/gpu.product=NVIDIA-L4 -o name | wc -l)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetops",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "private": true,
6
6
  "description": "Shared data layer, continuous calibration, root-cause analysis and safe optimization across the AIInfraTools utilities.",
@@ -7,6 +7,9 @@
7
7
  // POST /v1/traces OTLP traces (JSON) → span
8
8
  // GET /metrics fleetops' own metrics (Prometheus text); GET /healthz
9
9
  //
10
+ // Hybrid fleets: a collector at another site sends `X-Fleetops-Site: <name>` (Prometheus remote_write `headers:`,
11
+ // the OpenTelemetry collector's `headers:`), and that request's records carry that site instead of --site.
12
+ //
10
13
  // OTLP/HTTP in protobuf (the collector default) or JSON, gzip or not. OTLP/gRPC (port 4317) is not served: use the
11
14
  // collector's otlphttp exporter.
12
15
  import http from 'node:http';
@@ -20,6 +23,7 @@ import { handleApi } from './api.mjs';
20
23
 
21
24
  const VENDOR_RE = Object.entries(VENDORS).filter(([, p]) => p.detect).map(([k, p]) => [k, new RegExp(p.detect)]);
22
25
  const vendorOf = name => (VENDOR_RE.find(([, re]) => re.test(name)) || [])[0];
26
+ export const SITE_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
23
27
  const esc = v => String(v).replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n');
24
28
 
25
29
  // Series (labels + samples) → device records: one exporter "scrape" per vendor and timestamp, through gpu-health's
@@ -205,6 +209,9 @@ export function server(pipe, { site, maxBody = 32 << 20, tokens = null, audit =
205
209
  }
206
210
  if (req.method !== 'POST') return send(res, 404, 'not found\n');
207
211
  if (!can(who, 'ingest')) return send(res, 403, 'needs the ingest role\n');
212
+ const hdrSite = req.headers['x-fleetops-site'];
213
+ if (hdrSite !== undefined && !SITE_RE.test(String(hdrSite))) return send(res, 400, 'x-fleetops-site: letters, digits, . _ - (up to 64)\n');
214
+ const reqSite = hdrSite !== undefined ? String(hdrSite) : site;
208
215
  let body = await read(req);
209
216
  const enc = String(req.headers['content-encoding'] || '').toLowerCase(); // collectors gzip by default
210
217
  if (enc === 'gzip') body = zlib.gunzipSync(body); else if (enc === 'deflate') body = zlib.inflateSync(body); else if (enc && enc !== 'identity' && enc !== 'snappy') return send(res, 415, `content-encoding ${enc} not supported\n`);
@@ -212,12 +219,12 @@ export function server(pipe, { site, maxBody = 32 << 20, tokens = null, audit =
212
219
  if (req.url === '/api/v1/write') {
213
220
  const series = decodeWriteRequest(snappyDecompress(body)), coll = seriesToCollectives(series);
214
221
  if (coll.length && !pipe.offer('collective', coll)) return send(res, 429, 'queue full, retry\n');
215
- const r = seriesToDevices(series.filter(x => !/^nccl_/.test(x.labels.__name__ || '')), { site }); pipe.m.unmapped += r.unmapped; kind = 'device'; recs = r.devices;
222
+ const r = seriesToDevices(series.filter(x => !/^nccl_/.test(x.labels.__name__ || '')), { site: reqSite }); pipe.m.unmapped += r.unmapped; kind = 'device'; recs = r.devices;
216
223
  } else if (/^\/v1\/(metrics|logs|traces)$/.test(req.url)) {
217
224
  const ct = req.headers['content-type'] || '', kindOf = req.url.slice(4);
218
225
  if (!/json|protobuf/.test(ct)) return send(res, 415, 'OTLP must be application/json or application/x-protobuf\n');
219
226
  const proto = /protobuf/.test(ct), j = proto ? decodeOtlp(kindOf, body) : JSON.parse(body.toString('utf8'));
220
- if (req.url === '/v1/metrics') { const r = seriesToDevices(otlpMetricsToSeries(j), { site }); pipe.m.unmapped += r.unmapped; kind = 'device'; recs = r.devices; }
227
+ if (req.url === '/v1/metrics') { const r = seriesToDevices(otlpMetricsToSeries(j), { site: reqSite }); pipe.m.unmapped += r.unmapped; kind = 'device'; recs = r.devices; }
221
228
  else if (req.url === '/v1/logs') { const r = otlpLogsToRecords(j); pipe.m.unmapped += r.unmatched; kind = 'log'; recs = r.logs; }
222
229
  else { kind = 'span'; recs = otlpTracesToSpans(j); }
223
230
  } else return send(res, 404, 'not found\n');
@@ -219,6 +219,16 @@ export function toYaml(o, ind = 0) {
219
219
  // runner(argv, { input }) → { code, out, err }: kubectl, real or not (tests)
220
220
  export const kubectl = (argv, { input } = {}) => { const r = spawnSync('kubectl', argv, { input, encoding: 'utf8', maxBuffer: 64 << 20 }); return { code: r.error ? 127 : r.status, out: r.stdout || '', err: r.stderr || (r.error ? r.error.message : '') }; };
221
221
 
222
+ // The GPU model on a node, whichever cloud labelled it: GPU Feature Discovery's labels (any cluster with the NVIDIA or
223
+ // AMD operator), GKE's accelerator label, else the instance type (EKS, AKS, GKE, neocloud VMs named like a cloud's).
224
+ const PRODUCT_LABELS = [...new Set(Object.values(REG.VENDORS).flatMap(v => v.productLabels))];
225
+ export function gpuProductOf(labels) {
226
+ const l = PRODUCT_LABELS.map(k => labels[k]).find(Boolean);
227
+ if (l) return l;
228
+ const inst = REG.instanceOf(labels['node.kubernetes.io/instance-type'] || labels['beta.kubernetes.io/instance-type']);
229
+ return inst ? inst.chip : '';
230
+ }
231
+
222
232
  // What the cluster has: GPUs per node of the resource, CRDs, the secret.
223
233
  export function preflight(d, { runner = kubectl, helm = helmRun } = {}) {
224
234
  const checks = [], ok = (name, pass, detail) => checks.push({ name, pass, detail });
@@ -228,7 +238,7 @@ export function preflight(d, { runner = kubectl, helm = helmRun } = {}) {
228
238
  const nodes = runner(['get', 'nodes', '-o', 'json']);
229
239
  if (nodes.code === 0) {
230
240
  const items = JSON.parse(nodes.out).items || [];
231
- const per = items.map(n => ({ name: n.metadata.name, gpus: +((n.status.allocatable || {})[d.needs.gpuResource] || 0), product: (n.metadata.labels || {})['nvidia.com/gpu.product'] || (n.metadata.labels || {})['amd.com/gpu.product-name'] || '', ready: (n.status.conditions || []).some(c => c.type === 'Ready' && c.status === 'True'), cordoned: !!(n.spec || {}).unschedulable }));
241
+ const per = items.map(n => ({ name: n.metadata.name, gpus: +((n.status.allocatable || {})[d.needs.gpuResource] || 0), product: gpuProductOf(n.metadata.labels || {}), ready: (n.status.conditions || []).some(c => c.type === 'Ready' && c.status === 'True'), cordoned: !!(n.spec || {}).unschedulable }));
232
242
  const usable = per.filter(n => n.ready && !n.cordoned && n.gpus >= (d.needs.pods ? Math.min(...d.needs.pods) : d.needs.perPod));
233
243
  let fitPods, podsNeeded;
234
244
  if (d.needs.pods) {
@@ -10,6 +10,9 @@ const read = p => readFileSync(join(here, p), 'utf8');
10
10
  const page = read('src/index.src.html');
11
11
  const inlined = {
12
12
  '/*ACCELERATORS*/': readFileSync(join(here, '../inference-sizer/src/accelerators.js'), 'utf8'),
13
+ // the sizer's catalog and model: FleetScope's model list comes from the catalog, its KV per token from the model
14
+ '/*SIZERCATALOG*/': readFileSync(join(here, '../inference-sizer/src/catalog.js'), 'utf8'),
15
+ '/*SIZERMODEL*/': readFileSync(join(here, '../inference-sizer/src/model.js'), 'utf8'),
13
16
  '/*ENGINE*/': read('src/engine.js'),
14
17
  '/*TEMPLATES*/': read('src/templates.js'),
15
18
  '/*INGEST*/': read('src/ingest.js'),