feat(cluster-agent): send the scheduling goodput of Kueue and KAI from the Cluster Agent #61760
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #61760"
general
weight: 0.35
gjulianm
What does this PR do?
Adds a
job_scheduler_goodputcheck to the Cluster Agent. The Cluster Agent leader sends the scheduling goodput of Kueue Workloads and KAI Scheduler PodGroups: how much of the GPU time that GPU workloads request is spent waiting to become fully runnable. It is off by default and does not change anything else.Metrics
gpu.scheduling.badput_timeandgpu.scheduling.fully_admitted_time, counts in GPU-hours. On every run each GPU workload addsseconds since the previous run × requested GPUsto one of them, according to its state at the start of the interval. Goodput isfully_admitted / (fully_admitted + badput)at query time.job_scheduler,job_scheduler_queue,job_scheduler_workload,kube_namespace,kueue_workload/kueue_local_queue/kueue_cluster_queueorkai_pod_group/kai_queue, andgpu_typewhen known.reason, one of six scheduler-independent categories (quota_or_capacity,placement_or_topology,configuration_or_request,preemption_or_reclaim,startup_or_system,other_or_unknown), and the rawscheduler_reason. Series have no host and carrykube_cluster_name,orch_cluster_idand the Agent's configured global tags.What counts as fully runnable
AdmittedandPodsReady(requireswaitForPodsReady; without it a Workload is not counted). A Workload waiting to recover (PodsReady=False,WaitForRecovery) is badput (reason:startup_or_system,scheduler_reason:WaitForRecovery). That badput is held and submitted when the recovery ends, and dropped if the Workload finishes instead, because Kueue also reportsWaitForRecoveryfor a few seconds beforeFinished. GPUs are(admitted pods − reclaimable pods) × GPUs per pod, with the kube-scheduler init container and sidecar rule. Everything comes from the Cluster Agent workloadmeta: Workload conditions and pod sets, the LocalQueue (ClusterQueue of unadmitted Workloads) and the ResourceFlavor node labels (gpu_type). No tagger, no API calls.Runningand not being deleted, with at leastminMemberpods running or succeeded. GPUs are the requests of the active pods plus their KAIgpu-fractionannotation. KAI has no readiness condition, so the check watches the pods of the KAI scheduler with an informer filtered byspec.schedulerName(setting below), started on the leader only and keeping only the fields goodput reads: GPU requests and limits, init-container restart policy, node selector and required node affinity, thepod-group-nameandgpu-fractionannotations, phase, deletion timestamp and container termination times. If the pod watch receives nothing, not even the bookmark the API server sends about every minute, for 3 minutes, a new informer lists the pods again. Counting goes on from that fresh list, or starts a new baseline if the list does not complete. A Forbidden or Unauthorized error stops the informer at once. This is a second pod watch next to the one workloadmeta runs when KAI metadata is on, because workloadmeta pods carry none of those fields and adding them would grow the entity type that node Agents also link. For a PodGroup without active pods it reads the owning batch Job to tell a retry from completion: finished Jobs once, active or suspended ones at most every 60 s (the first read after a running PodGroup's pods stop is not cached), at most 20 reads and 10 s per run, PodGroups that were running first. While its Job is not read, a running PodGroup is still counted until its last pod finished and a waiting one contributes nothing; after 3 failed reads, or at once on a Forbidden error, it is handled as having no known owner, like the Python check.Settings (all off by default):
cluster_agent.kueue.goodput.enabled(requirescluster_agent.kueue.enabled),cluster_agent.kai_scheduler.goodput.enabled(requirescluster_agent.kai_scheduler.enabled) andcluster_agent.kai_scheduler.goodput.scheduler_name(defaultkai-scheduler, for installs such as NVIDIA Run:ai). The check needsleader_election. KAI needs RBAC for the Cluster Agent tolist/watchpods cluster-wide andgetbatchjobs.The goodput data is added to the
SchedulerEventspayload of the Kueue Workload and KAI PodGroup entities, filled only when the flag is on and not part of the kube metadata stream, so node Agents get no new data and their binaries do not grow.IsLeaderis moved next toRunLeaderElectionand shared withjob_scheduler_events.Motivation
Scheduling goodput answers "are my workloads waiting too long to get the GPUs they requested?" for the Accelerator Telemetry fleet allocation use cases. The prototype lived in the Python node checks, which needed a leader-only hack for Kueue and a "one instance only" rule for KAI. With the job scheduler work moving to the Cluster Agent (#61005), the cluster-level view and leader election make it a better home.
Design: scheduling goodput, job scheduler split. Python reference and review history: DataDog/integrations-core#26012.
Describe how you validated your changes
Unit tests for the parsers and the check, with the design-doc scenarios ported from integrations-core#26012: normal run, not enough resources, partial scheduling, admitted but unable to run, preemption, Kueue quota exhausted, and 18 overlapping workloads whose series must sum to the right GPU-hours in every grouping. Also the reason mapping,
gpu_type(flavors, mixed flavors, pod selectors), the KAI cutoffs (last pod, Job end, earlier attempts), Job reads that are skipped or fail, leader and follower runs, the pod informer lifecycle (start, stop, restart, not synced) andCancelracingRun.dda inv test --raceon the touched packages,dda inv linter.go(cluster-agent),dda inv schema.lint, the release note lint, gazelle, the tag manifest, buildifier anddda inv cluster-agent.buildpass. Every commit builds on its own.Run on a local kind cluster (8 fake GPUs) with Kueue v0.20.7 (
waitForPodsReady), KAI Scheduler v0.19.0 and a fakeintake, at c0ff6443483. In every scenario the GPU-seconds matchseconds × GPUsfrom the Kubernetes timestamps within one 15 s interval per transition, with the expectedreason,scheduler_reasonand tags:Finished; quota exhausted (WaitingForQuota); request above the queue maximum (ExceedsMaxQuota,reason:configuration_or_requestas in the doc's category table); admitted but unable to run (WaitForStart); preemption (preemption_or_reclaimuntil readmitted);gpu_typefrom the ResourceFlavor; ClusterQueue tag on unadmitted Workloads.PartiallyRunning); retry wait then Job failure (NoPods); noget jobsRBAC (warning, unknown-owner fallback, nothing kept forever).Additional Notes
- workloadmeta has no freshness signal, so if the Workload or PodGroup watch breaks, the check keeps counting the last state it saw instead of starting a new baseline.
- KAI: the 60 s cache of an active owning Job can overcount badput by up to 60 s for a PodGroup without pods whose Job finishes while cached. Accepted to keep Job reads bounded.
- Kueue: recovery badput is submitted when the recovery ends, not over the intervals it covers. It is dropped if the Workload disappears, cannot be read, or the leader changes during the recovery.
gpu_typeonly comes from what the pods require, not from the GPU actually assigned.gpu/metadata.csvwording in integrations-core, a metric source and origin mapping forjob_scheduler_goodput(needs a dd-source origin ID; until then the series have unknown origin), and an e2e test with fakeintake (owned by Accelerator Telemetry, after the kind validation).