diff --git a/tests/data/sinfo.txt b/tests/data/sinfo.txt index bf859e3..4dcb4ae 100644 --- a/tests/data/sinfo.txt +++ b/tests/data/sinfo.txt @@ -1,4 +1,4 @@ -N/A Devel nazare001 idle 0/20/0/20 128000 (null) +N/A Devel nazare001 idle 0/20/0/20 128000 (null) N/A GPU-short budbud001 mixed 20/20/0/40 184000 gpu:t4:2,mps:t4:2000 N/A A40-short budbud002 allocated 40/0/0/40 184000 gpu:a40:2,mps:a40:20 N/A AMD-short cloudbreak001 drained 0/0/32/32 128000 (null) @@ -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) diff --git a/tests/test_slurm.py b/tests/test_slurm.py index 779a5c3..7901cc3 100644 --- a/tests/test_slurm.py +++ b/tests/test_slurm.py @@ -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']