From 9e30a0277665fea4b011c2e41371d7e3150b1ab2 Mon Sep 17 00:00:00 2001 From: Tim Shea Date: Thu, 20 Jul 2023 06:04:42 -0700 Subject: [PATCH] Fix partition parse bug for internal vLab (#741) * Adding deprecated lava.utils.system. * Update system.py * Update system.py * Bugfix for missing fields in sinfo. --------- Co-authored-by: PhilippPlank <32519998+PhilippPlank@users.noreply.github.com> --- src/lava/utils/slurm.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/lava/utils/slurm.py b/src/lava/utils/slurm.py index 8d38842ce..7a7cf071d 100644 --- a/src/lava/utils/slurm.py +++ b/src/lava/utils/slurm.py @@ -118,14 +118,18 @@ def get_partitions() -> ty.List[PartitionInfo]: def parse_partition(line: str) -> PartitionInfo: fields = line.split() - - return PartitionInfo(name=fields[0], - available=fields[1], - timelimit=fields[2], - nodes=fields[3], - state=fields[4], - nodelist=fields[5]) - + name = fields[0] + avail = fields[1] if len(fields) > 1 else '' + limit = fields[2] if len(fields) > 2 else '' + nodes = fields[3] if len(fields) > 3 else '' + state = fields[4] if len(fields) > 4 else '' + nodel = fields[5] if len(fields) > 5 else '' + return PartitionInfo(name=name, + available=avail, + timelimit=limit, + nodes=nodes, + state=state, + nodelist=nodel) return [parse_partition(line) for line in lines]