Add SLURM gres extraction from resources
This commit is contained in:
parent
21935f15f5
commit
05be86da07
2 changed files with 23 additions and 0 deletions
|
@ -181,3 +181,15 @@ def sinfo_from_file(fname, with_states=('idle', 'mixed')) -> dict:
|
|||
def sinfo(username: str = None, with_states=('idle', 'mixed')) -> dict:
|
||||
"""SLURM SINFO resources available for a given user."""
|
||||
return sinfo_filter(sinfo_reader(sinfo_run(username=username)), with_states=with_states)
|
||||
|
||||
|
||||
def gres(resources: dict) -> list:
|
||||
"""List SLURM GPU resources."""
|
||||
return sorted(
|
||||
{
|
||||
node.gpu.name
|
||||
for cluster in resources.values()
|
||||
for partition in cluster
|
||||
for node in partition
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue