From e46f4727012c2724ec8b6c448c97b32222adcab4 Mon Sep 17 00:00:00 2001 From: Giacomo Marciani Date: Fri, 9 Oct 2026 13:50:05 -0400 Subject: [PATCH] [clustermgtd] Fix an issue where the Comment and Extra fields of Slurm nodes and the Comment field of Slurm reservations could alter the node and reservation information read by ParallelCluster. --- CHANGELOG.md | 2 + src/common/schedulers/slurm_commands.py | 9 +- .../schedulers/slurm_reservation_commands.py | 2 +- .../common/schedulers/test_slurm_commands.py | 161 +++++++++++++++++- .../test_slurm_reservation_commands.py | 1 + 5 files changed, 172 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8eb2111..4b5c8031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ This file is used to list changes made in each version of the aws-parallelcluste **BUG FIXES** - Fix an issue where EC2 throttling during compute node launch is not retried and is reported as insufficient capacity when using Multiple Instance Types or multiple subnets. +- Fix an issue where the Comment and Extra fields of Slurm nodes and the Comment field of Slurm reservations + could alter the node and reservation information read by ParallelCluster. 3.16.1 ------ diff --git a/src/common/schedulers/slurm_commands.py b/src/common/schedulers/slurm_commands.py index a46e4412..dbec3dd8 100644 --- a/src/common/schedulers/slurm_commands.py +++ b/src/common/schedulers/slurm_commands.py @@ -75,10 +75,15 @@ r"|(LastBusyTime=\S+)" r"|(ReservationName=\S+)" r"|(InstanceId=\S+)" - r"|(Reason=.*)", + r"|(Reason=.*)" + r"|(Comment=.*)" + r"|(Extra=.*)", re.MULTILINE, ) +# Fields matched up to the end of the line and discarded, to prevent their free-text content from being parsed as fields +SCONTROL_DISCARDED_FIELDS = ("Comment", "Extra") + # Fields extracted from `scontrol show partitions` output. `(? List[Dict[str, st fields = {} for match in field_regex.finditer(record): key, _, value = match.group(0).partition("=") + if key in SCONTROL_DISCARDED_FIELDS: + continue fields[key] = value if fields: records.append(fields) diff --git a/src/common/schedulers/slurm_reservation_commands.py b/src/common/schedulers/slurm_reservation_commands.py index afd71681..645c9c56 100644 --- a/src/common/schedulers/slurm_reservation_commands.py +++ b/src/common/schedulers/slurm_reservation_commands.py @@ -39,7 +39,7 @@ # Fields extracted from raw `scontrol show reservations` output. Only `ReservationName` is anchored at the # start of a line; `(?