Add slurm partition eq comparison
This commit is contained in:
parent
4eef9d7016
commit
e8ae32cc86
2 changed files with 5 additions and 1 deletions
|
@ -82,6 +82,9 @@ class SlurmPartition:
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.nodes)
|
return len(self.nodes)
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return str(self) == str(other)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gpus(self) -> str:
|
def gpus(self) -> str:
|
||||||
"""List of GPUs available."""
|
"""List of GPUs available."""
|
||||||
|
|
|
@ -72,6 +72,7 @@ def test_slurm_dataclasses():
|
||||||
|
|
||||||
assert str(partition) == 'standard' # = name
|
assert str(partition) == 'standard' # = name
|
||||||
assert partition.name == 'standard'
|
assert partition.name == 'standard'
|
||||||
|
assert partition == 'standard' # __eq__ on name
|
||||||
|
|
||||||
assert len(partition) == 1
|
assert len(partition) == 1
|
||||||
|
|
||||||
|
@ -87,7 +88,7 @@ def test_slurm_dataclasses():
|
||||||
|
|
||||||
assert str(cluster) == 'nautilus' # = name
|
assert str(cluster) == 'nautilus' # = name
|
||||||
assert cluster.name == 'nautilus'
|
assert cluster.name == 'nautilus'
|
||||||
assert cluster == 'nautilus' # __eq__
|
assert cluster == 'nautilus' # __eq__ on name
|
||||||
|
|
||||||
assert len(cluster) == 1
|
assert len(cluster) == 1
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue