Add slurmrestd (REST API) collection mode to the Slurm integration#24566
Draft
zhuminyi wants to merge 1 commit into
Draft
Add slurmrestd (REST API) collection mode to the Slurm integration#24566zhuminyi wants to merge 1 commit into
zhuminyi wants to merge 1 commit into
Conversation
|
zhuminyi
force-pushed
the
slurm-rest-mode
branch
from
July 15, 2026 19:37
e485713 to
f2de109
Compare
zhuminyi
force-pushed
the
slurm-rest-mode
branch
from
July 15, 2026 20:11
f2de109 to
52e7369
Compare
zhuminyi
force-pushed
the
slurm-rest-mode
branch
from
July 17, 2026 03:38
7a24b78 to
8c6752c
Compare
Add an optional slurmrestd (REST) collection mode. When slurm_rest_api_url is set, the check collects scheduler (sdiag), partition, and node (sinfo) metrics from the Slurm REST API over HTTP with a JWT token instead of executing the Slurm CLI binaries, enabling a no-sidecar deployment (for example as a cluster check) for containerized Slurm such as SUNK/Slinky. Per-node and per-partition GPU counts are collected when collect_gpu_stats is enabled: node GPU from each node's gres/gres_used, partition GPU aggregated across the partition's nodes (the /partitions payload carries no GPU field).
zhuminyi
force-pushed
the
slurm-rest-mode
branch
from
July 17, 2026 03:50
8c6752c to
a5ad900
Compare
Contributor
Validation Report
Run Passed validations (19)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds an optional REST-API collection mode to the Slurm integration: when
slurm_rest_api_urlis set, the check collects scheduler (sdiag), partition, and node (sinfo) metrics fromslurmrestdover HTTP with a JWT token, instead of executing the Slurm CLI binaries. CLI mode remains the default and is completely unaffected when the new fields are absent.rest.py: a thinslurmrestdHTTP client (SlurmRestAPIClient) that never raises on transport/API errors — it logs and returnsNoneso the caller can emit aslurm.rest.can_connectservice check and skip metrics for that run, rather than crashing the check.slurm_rest_api_url(its presence enables REST mode),slurm_rest_api_token/slurm_rest_api_token_file(the token file is re-read fresh every check run, so rotated tokens are picked up),slurm_openapi_version(defaultv0.0.42), andslurm_rest_api_user(optional — sent asX-SLURM-USER-NAMEalongside the JWT, needed only whenslurmrestdsits behind an authenticating proxy that reuses one privileged token for multiple users; a direct per-user JWT, e.g. viascontrol token, already identifies the user via its own claims and does not need this).node.cpu_loadcorrectly divided by 100 to match slurmrestd's scaling; one series per (node, partition) soslurm_partition_namestays single-valued; every numeric node/partition field routed through a sharedunwrap_numberhelper, sinceslurmrestd'sdata_parserwraps some integer fields as{"set","infinite","number"}depending on OpenAPI/build version and an inconsistently-unwrapped field would otherwise be silently dropped rather than erroring).squeue/sacct/sshare/scontrolcollection remains CLI-only; REST mode logs a warning (not a silent gap) if those are requested while REST mode is active.Motivation
On Slurm-on-Kubernetes deployments (SUNK, Slinky), the existing CLI-based check requires the Datadog Agent to have direct access to the Slurm CLI binaries and
munge/auth socket access — which in practice means either running the agent on a bare-metal/VM head node (the only currently-documented deployment) or injecting a sidecar with staged-in binaries into a login pod, with the accompanying helm-chart changes.slurmrestd(Slurm's REST API daemon) is already commonly available on these clusters and only needs network access plus a JWT — no co-located binaries, nomungesocket. This lets the check run as a normal Kubernetes cluster check (dispatched by the Cluster Agent against aslurmrestdService), with no sidecar and no per-pod injection, and with no login node required at all if one isn't already present.This was verified end-to-end on a real Slinky Slurm cluster: deployed as a cluster check against
slurmrestd, confirmed metric correctness against the equivalent CLI-mode output, and confirmed it runs correctly alongside a separate node-agent feature (Slurm-job GPU tagging,DataDog/datadog-agent#53697) with no interference — the two changes are complementary pieces of removing the Slurm sidecar dependency entirely, each shipped independently.Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged