Remove SLURM parsing of N/A cluster
This commit is contained in:
parent
b26425d4cf
commit
84361f183e
2 changed files with 5 additions and 5 deletions
|
@ -51,7 +51,7 @@ class SlurmNode:
|
||||||
gpu: SlurmGpu
|
gpu: SlurmGpu
|
||||||
|
|
||||||
def __init__(self, cluster, partition, hostname, state, cpus_state, memory_mb, gres): # noqa: PLR0913
|
def __init__(self, cluster, partition, hostname, state, cpus_state, memory_mb, gres): # noqa: PLR0913
|
||||||
self.cluster = None if 'N/A' in cluster else cluster.strip()
|
self.cluster = cluster.strip()
|
||||||
self.partition = partition.strip()
|
self.partition = partition.strip()
|
||||||
self.hostname = hostname.strip()
|
self.hostname = hostname.strip()
|
||||||
self.state = state.strip().lower()
|
self.state = state.strip().lower()
|
||||||
|
|
|
@ -80,7 +80,7 @@ def test_slurm_sinfo_reader():
|
||||||
|
|
||||||
node = nodes[0]
|
node = nodes[0]
|
||||||
|
|
||||||
assert node.cluster is None
|
assert node.cluster == 'N/A'
|
||||||
assert node.partition == 'Devel'
|
assert node.partition == 'Devel'
|
||||||
assert node.hostname == 'nazare001'
|
assert node.hostname == 'nazare001'
|
||||||
assert node.state == 'idle'
|
assert node.state == 'idle'
|
||||||
|
@ -89,7 +89,7 @@ def test_slurm_sinfo_reader():
|
||||||
assert node.mem == 128
|
assert node.mem == 128
|
||||||
assert not node.gpu
|
assert not node.gpu
|
||||||
|
|
||||||
assert [node.cluster for node in nodes] == 7 * [None] + 6 * ['nautilus'] + 4 * ['waves']
|
assert [node.cluster for node in nodes] == 7 * ['N/A'] + 6 * ['nautilus'] + 4 * ['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')]) == 7
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ def test_slurm_sinfo_filter(monkeypatch):
|
||||||
|
|
||||||
assert isinstance(clusters, dict)
|
assert isinstance(clusters, dict)
|
||||||
assert len(clusters) == 3
|
assert len(clusters) == 3
|
||||||
assert list(clusters) == [None, 'nautilus', 'waves']
|
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, 2, 2]
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ def test_slurm_sinfo_filter(monkeypatch):
|
||||||
# Get only `idle` nodes
|
# Get only `idle` nodes
|
||||||
clusters = sinfo_filter(resources, with_states=('idle'))
|
clusters = sinfo_filter(resources, with_states=('idle'))
|
||||||
|
|
||||||
assert list(clusters) == [None, 'nautilus', 'waves']
|
assert list(clusters) == ['N/A', 'nautilus', 'waves']
|
||||||
assert [len(partitions) for partitions in clusters.values()] == [1, 2, 1]
|
assert [len(partitions) for partitions in clusters.values()] == [1, 2, 1]
|
||||||
|
|
||||||
# Discard clusters without partition available
|
# Discard clusters without partition available
|
||||||
|
|
Loading…
Add table
Reference in a new issue