Skip to content

Commit

Permalink
Sort get_partitions
Browse files Browse the repository at this point in the history
  • Loading branch information
maouw committed Sep 20, 2023
1 parent b8876d6 commit 2584d39
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hyakvnc/slurmutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_default_account(user: Optional[str] = None, cluster: Optional[str] = Non

def get_partitions(user: Optional[str] = None,
account: Optional[str] = None,
cluster: Optional[str] = None) -> set[str]:
cluster: Optional[str] = None) -> list[str]:
"""
Gets the SLURM partitions for the specified user and account on the specified cluster.
Expand All @@ -59,7 +59,7 @@ def get_partitions(user: Optional[str] = None,
res = subprocess.run(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True).stdout.splitlines()

if any(partitions := x for x in res):
return {x.strip(f"{account}-") for x in partitions.split(',')}
return sorted([x.strip(f"{account}-") for x in partitions.split(',')])
else:
raise LookupError(f"Could not find partitions for user '{user}' and account '{account}' on cluster '{cluster}'")

Expand Down

0 comments on commit 2584d39

Please sign in to comment.