slurm: prevent nodehost column truncation in get_cluster_info#946
Open
samoz83 wants to merge 1 commit into
Open
slurm: prevent nodehost column truncation in get_cluster_info#946samoz83 wants to merge 1 commit into
samoz83 wants to merge 1 commit into
Conversation
Contributor
|
I'm really unsatisfied with the fact that we make multiple calls to find the max length. Can't we just set the limit to some super high number like 100? This would save us the additional |
The sinfo -O nodehost field uses a default 20-char column width.
On clusters whose node FQDNs exceed 20 characters, sinfo truncates the
hostname to 20 chars with no separating whitespace before the next
column. line.split then yields one fewer token than expected, shifting
the gresused string into the slot the code reads as the configured
gres, and the state string into the slot read as gresused.
Net effect: total_gpus is computed from GresUsed (the in-use count) and
active_gpus parses a state word and evaluates to 0. The dashboard's
System Status widget then displays "GPUs Available" as the number of
GPUs currently in use.
Pass explicit widths to every sinfo -O field so columns can't run
together regardless of hostname or gres string length:
- nodehost: 100
- gres / gresused: 512 (the existing test fixture already contains
multi-GRES strings up to 238 chars; 512 gives ~2x headroom)
This also drops the auxiliary 'sinfo -o %G' call that previously
computed a dynamic gres column width, reducing per-refresh subprocess
overhead from three sinfo calls to two.
2d4be34 to
31f3b36
Compare
Author
|
Pushed an update that drops both dynamic-sizing sinfo calls and uses fixed widths instead. Picked 512 for gres/gresused as it was double the longest gres string in the existing test fixture. Also added a regression test so future refactors don't silently re-trigger the truncation case. |
johrstrom
approved these changes
May 29, 2026
Contributor
johrstrom
left a comment
There was a problem hiding this comment.
Thanks! This looks good to me.
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?
Fixes
OodCore::Job::Adapters::Slurm::Batch#get_cluster_infoso that GPUcounts are parsed correctly on clusters with node FQDNs longer than
20 characters.
sinfo -Ouses a default width of 20 characters for thenodehostfield.When a hostname exceeds that width, sinfo truncates it and emits no
separating whitespace before the next column, causing
line.splittoreturn 3 tokens instead of 4. The
gresandgresusedcolumns are thenread from the wrong indices:
total_gpusends up summing GresUsed (thein-use count) and
active_gpustries to parse the state string(
"mixed","idle", …), which the GPU regex never matches, so itevaluates to 0. The dashboard's System Status widget consequently renders
"GPUs Available" as the number of GPUs currently in use.
The fix sizes the
nodehostcolumn dynamically fromsinfo -ho %n,mirroring how
gres_lengthis already calculated, so the format stringalways reserves enough space to keep the columns separated regardless of
hostname length.
Related issue
Closes #945
Testing
Checklist
Anything else?
The fix has been validated on a real cluster running OOD 4.2.2 with
ood_core0.31.1: applied as a dashboard initializer monkey-patch first(to confirm), then upstreamed here. After applying, the System Status
widget shows the correct
configured − in_useGPU count rather than thein-use count.