Skip to content

Database API error when parsing GPU from tres #421

Description

@emi80

Hi all,
first of all thanks for this really nice package. We are using it in our HPC cluster and has been very good so far.

I just found that the pyslurm.db.tres.GPU.from_tres method raise an exception if the GPU tres type has more than one :. This is not very common but it should just be ignored and actually the fix is just one change to the tres.name.split line.

The snipped below reproduces the issue:

from pyslurm import db

if __name__ == "__main__":
    jobs = db.Jobs().load()

And this is the error:

Traceback (most recent call last):
  File "test.py", line 4, in <module>
    jobs = db.Jobs().load()
  File "pyslurm/db/job.pyx", line 271, in pyslurm.db.job.Jobs.load
  File "pyslurm/db/tres.pyx", line 325, in pyslurm.db.tres.TrackableResources.load
  File "pyslurm/db/tres.pyx", line 282, in pyslurm.db.tres.TrackableResources._handle_tres_type
  File "pyslurm/db/tres.pyx", line 394, in pyslurm.db.tres.GPU.from_tres
ValueError: too many values to unpack (expected 2)

Of course, I'll be happy to create a PR with the fix.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions