Skip to content

Commit

Permalink
Fix partition parse bug for internal vLab (lava-nc#741)
Browse files Browse the repository at this point in the history
* Adding deprecated lava.utils.system.

* Update system.py

* Update system.py

* Bugfix for missing fields in sinfo.

---------

Co-authored-by: PhilippPlank <[email protected]>
  • Loading branch information
tim-shea and PhilippPlank authored Jul 20, 2023
1 parent f7dcef8 commit 9e30a02
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/lava/utils/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]


Expand Down

0 comments on commit 9e30a02

Please sign in to comment.