Skip to content

Commit 4054569

Browse files
authored
Merge pull request #12 from kcgthb/gpu_parse
Skip socket information when parsing gres field
2 parents 3d2109a + 56c31de commit 4054569

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

slurm_usage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,8 +1559,8 @@ def _get_node_info_from_slurm() -> dict[str, dict[str, int]]: # noqa: PLR0912
15591559

15601560
# Parse GRES string (e.g., "gpu:4" or "gpu:v100:4")
15611561
if "gpu:" in gres:
1562-
# Handle formats like "gpu:4" or "gpu:v100:4"
1563-
gpu_parts = gres.split(":")
1562+
# Handle formats like "gpu:4" or "gpu:v100:4" of "gpu:8(S:0-1)"
1563+
gpu_parts = re.sub("\\(S:[0-9-]+\\)", "", gres).split(":")
15641564
# The GPU count is always the last number
15651565
if gpu_parts and gpu_parts[-1].isdigit():
15661566
gpu_count = int(gpu_parts[-1])

0 commit comments

Comments
 (0)