From f617c6a277522d7f9ca005ee0c801643083a83bb Mon Sep 17 00:00:00 2001 From: Aditi Gaur Date: Tue, 17 Mar 2026 11:23:00 -0700 Subject: [PATCH] Fix a bug in azslurm cost Job State is a list and not a static field. --- azure-slurm/slurmcc/cost.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/azure-slurm/slurmcc/cost.py b/azure-slurm/slurmcc/cost.py index 6f1133b7..d2561a5c 100644 --- a/azure-slurm/slurmcc/cost.py +++ b/azure-slurm/slurmcc/cost.py @@ -40,7 +40,7 @@ class CostSlurm: def __init__(self, start:str, end: str, cluster: str, cache_root: str, fmt: str=None) -> None: self.start = start - self. end = end + self.end = end self.cluster = cluster self.sacct = shutil.which("sacct") if not self.sacct: @@ -137,7 +137,11 @@ def process_queue(self) -> dict: data = json.load(fp) for job in data['jobs']: - if job['job_state'] != 'RUNNING' and job['job_state'] != 'CONFIGURING': + # job_state is a list in newer Slurm versions (e.g., ['RUNNING', 'CONFIGURING', 'POWER_UP_NODE']) + job_states = job['job_state'] + if isinstance(job_states, str): + job_states = [job_states] + if 'RUNNING' not in job_states and 'CONFIGURING' not in job_states: continue job_id = job['job_id'] if job['admin_comment']: