PySlurm / pyslurm

Python Interface to Slurm
https://pyslurm.github.io
GNU General Public License v2.0
467 stars 116 forks source link

Unclear that `Jobs.load()` returns a dictionary. #298

Open multimeric opened 1 year ago

multimeric commented 1 year ago

I'm testing out the new API. It seems that Jobs.load() returns a dict[int, Job] whose keys are the job IDs. However this isn't explained in the docs. This is a change from the previous API which returned some kind of list-type iterable (I forget what).

tazend commented 1 year ago

Hi,

the Jobs class basically inherits from dict, and Jobs.load() returns a new instance of a Jobs collection that contains all the jobs in the system at the moment of calling. The documentation only says that the Jobs class inherits from dict (Bases: dict at the top) and contains Job objects, so I agree that it might not be entirely clear that the keys of this dict are the job ids.

I will try to make it more clear in the docs that the Jobs collection inherits from dict and basically has the form of dict[int, Job], where the keys are the job-ids. Would that be good?

multimeric commented 1 year ago

Okay that's a fair point, there is technically the right information there already. I think it's hindered by the fact that my IDE has no idea what fields these classes have. But the information you mention would be a good addition.