Fix sinfo partition named all

This commit is contained in:
Benoît Seignovert 2024-02-19 17:26:39 +01:00
parent a163ecb575
commit fc54701400
Signed by: Benoît Seignovert
GPG key ID: F5D8895227D18A0B
2 changed files with 24 additions and 16 deletions

View file

@ -10,8 +10,16 @@ nautilus bigmem cnode002 planned
nautilus gpu gnode1 mixed 4/92/0/96 768000 gpu:A100:1(S:0-1)
nautilus gpu gnode2 idle 0/96/0/96 256000 gpu:A100:2(S:0-1)
nautilus gpu gnode3 allocated 96/0/0/96 128000 gpu:A100:4(S:0-1)
nautilus visu visu1 idle 0/96/0/96 768000 (null)
nautilus all cnode001 completing 0/96/0/96 384000 (null)
nautilus all cnode002 planned 0/96/0/96 768000 (null)
nautilus all gnode1 mixed 4/92/0/96 768000 gpu:A100:1(S:0-1)
nautilus all gnode2 idle 0/96/0/96 256000 gpu:A100:2(S:0-1)
nautilus all gnode3 allocated 96/0/0/96 128000 gpu:A100:4(S:0-1)
nautilus all visu1 idle 0/96/0/96 768000 (null)
waves standard cribbar001 idle 0/40/0/40 128000 (null)
waves standard cribbar001 mixed 30/10/0/40 16000 (null)
waves gpu budbud006 allocated 64/0/0/64 256000 gpu:a100:2,mps:a100:
waves all cribbar001 mixed 20/20/0/40 128000 (null)
waves all cribbar001 mixed 30/10/0/40 16000 (null)
waves all budbud006 allocated 64/0/0/64 256000 gpu:a100:2,mps:a100:
waves all vmworker001 inval 0/0/8/8 16000 (null)
waves devel vmworker001 inval 0/0/8/8 16000 (null)

View file

@ -132,9 +132,9 @@ def test_slurm_sinfo_reader():
assert node.mem == 128
assert not node.gpu
assert [node.cluster for node in nodes] == 7 * ['N/A'] + 6 * ['nautilus'] + 4 * ['waves']
assert [node.cluster for node in nodes] == 7 * ['N/A'] + 12 * ['nautilus'] + 6 * ['waves']
assert len([node for node in nodes if node.state in ('idle', 'mixed')]) == 7
assert len([node for node in nodes if node.state in ('idle', 'mixed')]) == 10
for node in nodes:
if node.state == 'idle':
@ -147,7 +147,7 @@ def test_slurm_sinfo_reader():
assert node.cpu.allocated > 0
assert node.cpu.idle == 0
assert sum(node.mem for node in nodes) == 4_672
assert sum(node.mem for node in nodes) == 7_792
assert [node.gpu.name for node in nodes if node.gpu] == [
'T4',
@ -155,9 +155,9 @@ def test_slurm_sinfo_reader():
'P100',
'K80',
'P100',
] + 4 * ['A100']
] + 8 * ['A100']
assert [node.gpu.nb for node in nodes if node.gpu] == [2, 2, 2, 4, 1, 1, 2, 4, 2]
assert [node.gpu.nb for node in nodes if node.gpu] == [2, 2, 2, 4, 1, 1, 2, 4, 1, 2, 4, 2, 2]
def test_slurm_sinfo_filter(monkeypatch):
@ -170,13 +170,13 @@ def test_slurm_sinfo_filter(monkeypatch):
assert len(clusters) == 3
assert list(clusters) == ['N/A', 'nautilus', 'waves']
assert [len(partitions) for partitions in clusters.values()] == [2, 2, 2]
assert [len(partitions) for partitions in clusters.values()] == [2, 3, 2]
partitions = clusters['nautilus']
assert isinstance(partitions, dict)
assert len(partitions) == 2
assert list(partitions) == ['gpu', 'all']
assert len(partitions) == 3
assert list(partitions) == ['gpu', 'visu', 'all']
gpu_nodes = partitions['gpu']
@ -191,14 +191,14 @@ def test_slurm_sinfo_filter(monkeypatch):
# Get only `idle` nodes
clusters = sinfo_filter(resources, with_states=('idle'))
assert list(clusters) == ['N/A', 'nautilus', 'waves']
assert [len(partitions) for partitions in clusters.values()] == [1, 2, 1]
assert list(clusters) == ['N/A', 'nautilus']
assert [len(partitions) for partitions in clusters.values()] == [1, 3]
# Discard clusters without partition available
clusters = sinfo_filter(resources, with_states=('completing'))
assert list(clusters) == ['nautilus']
assert [len(partitions) for partitions in clusters.values()] == [1]
assert [len(partitions) for partitions in clusters.values()] == [2]
def test_slurm_sinfo_from_file(monkeypatch):
@ -210,7 +210,7 @@ def test_slurm_sinfo_from_file(monkeypatch):
for cluster, partitions in resources.items()
for nodes in partitions.values()
for node in nodes
] == ['nazare001', 'gnode2', 'visu1', 'cribbar001']
] == ['nazare001', 'gnode2', 'visu1', 'gnode2', 'visu1']
def test_slurm_sinfo_resources(monkeypatch):
@ -223,7 +223,7 @@ def test_slurm_sinfo_resources(monkeypatch):
partitions = clusters['nautilus']
assert list(partitions) == ['standard']
assert list(partitions) == ['standard', 'all']
std_nodes = partitions['standard']