PySlurm / pyslurm

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

Add `rss` fields #264

Closed multimeric closed 1 year ago

multimeric commented 1 year ago

Details

Issue

A few rss fields supported by the CLI are not returned by pyslurm: maxrss, maxrssnode, maxrsstask, and averss at least. Could these be added? I assume they are supported by the SLURM ABI.

tazend commented 1 year ago

Hi @multimeric

I can have a look at that. You mean for the slurmdb_jobs class, right?

multimeric commented 1 year ago

Yes that's right. I would like to return them from .get().

multimeric commented 1 year ago

This is actually pretty tricky now that I've looked into it. It's a field in the stats field of the job step class. It's not a top level job field at all.

tazend commented 1 year ago

Hi, since the rework of the slurmdb job api is currently ongoing (#269), I'll focus on properly implementing all the fields in the new api for now, instead of doing it in the current slurmdb_jobs class

The current API only returns the raw "TRESUsage*" strings. Theoretically, one could access values like maxrss, by looking at tres_usage_in_max str in the step for example and getting the value for the MEM TRES. But yeah, parsing that might not be so much fun, so a convenience attribute like max_rss is definitely a must :)

multimeric commented 1 year ago

If your API supports something like job.steps[0].stats["rss"].max then that would be fine too? I think that's how the C API works.

tazend commented 1 year ago

All the Job statistic fields are now available in the new recently released API (for 22.05 I just made a new release v22.5.2) The fields are described here

Each Step from the database will have a stats Attribute of type JobStatistics Additionally, each Database Job will also have a stats attribute of type JobStatistics. I added that one for convenience - so all the statistics from each step are summarized for the whole Job (but only those fields where it makes sense to actually sum them up, like total_cpu time for example)

Note that I have named the rss fields a bit different, i.e avg_rss is called avg_resident_memory If you have used the API already, let me know what you think and whether it works fine for you :)