Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyslurm/db/tres.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ cdef class GPU:
@staticmethod
def from_tres(tres):
if ":" in tres.name:
_, typ = tres.name.split(":")
_, typ = tres.name.split(":", 1)
else:
typ = None

Expand Down
11 changes: 11 additions & 0 deletions tests/unit/test_tres.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ def test_parse_tres_str():
assert tres.billing.type == "billing"


def test_parse_tres_str_gpu_type_with_multiple_colons():
input_str = "gres/gpu:nvidia-a100:1g.5gb=3"
tres = TrackableResources.from_str(input_str)

assert len(tres.gres) == 1
gres = tres.gres["gpu:nvidia-a100:1g.5gb"]
assert isinstance(gres, GPU)
assert gres.count == 3
assert gres.type == "nvidia-a100:1g.5gb"


def test_parse_gres_layout_str():
input_str = "gpu:nvidia-a100:5"
gres_dict = GenericResourceLayout.from_str(input_str)
Expand Down