Skip to content

Commit 33302a7

Browse files
authored
Increase the lenght of parser Name column in squeue (#259)
1 parent 9b2c12f commit 33302a7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

adaptive_scheduler/_scheduler/slurm.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def queue(*, me_only: bool = True) -> dict[str, dict[str, str]]:
403403
"""Get the queue of jobs."""
404404
python_format = {
405405
"JobID": 100,
406-
"Name": 100,
406+
"Name": 1000,
407407
"state": 100,
408408
"NumNodes": 100,
409409
"NumTasks": 100,
@@ -437,7 +437,16 @@ def line_to_dict(line: str) -> dict[str, str]:
437437
chars = list(line)
438438
info = {}
439439
for k, v in python_format.items():
440-
info[k] = "".join(chars[:v]).strip()
440+
value = "".join(chars[:v]).strip()
441+
if len(value) == v:
442+
# If this happens, we need to increase the format length for the given key.
443+
msg = (
444+
f"Extracted value for '{k}' ('{value}') is longer than"
445+
f" the allocated format length ({v})."
446+
" Please report this to the Adaptive Scheduler developers."
447+
)
448+
raise ValueError(msg)
449+
info[k] = value
441450
chars = chars[v:]
442451
return info
443452

0 commit comments

Comments
 (0)