On 07/14/2016 08:14 AM, Wolfgang Resch wrote:
Hi -

I'm trying to understand the slurmdb API better so i wrote a small C
program that just goes through the TRESs (slurmdb_tres_get) and QOSs
(slurmdb_qos_get) which works fine. However, i have a few things i'm not
sure i understand correctly:

(1) the `max_wall_pj` field in the `slurmdb_qos_rec_t` struct seems to
    be set to `INFINITE` when no limit was set in a QOS. Is that
    correct?

Yep.

(2) Is this the correct way to determine if the OverPartQOS flag is set
    in a qos (based on the `flags` field in `slurmdb_qos_rec_t`):

       (qos->flags & QOS_FLAG_BASE) & QOS_FLAG_OVER_PART_QOS

You can simplify that to just:

(qos->flags & QOS_FLAG_OVER_PART_QOS)

(3) the `max_tres_pu` field contains a string describing the tres
    limits. For example `1=128,1003=8` where 1 is the id of the CPU
    TRES and 1003 corresponts to the gres/gpu. Based on the comment
    in the source code `max_tres_pu_ctld` sounds like it might
    contain an array of just the values from that string but it
    seems to be set to NULL. What is the most straight forward way
    to get the TRES limit for a particular TRES out of `max_tres_pu`?

max_tres_pu_ctld isn't set for that API.

You'll need to parse the max_tres_pu string to get the individual values back out.

See slurmdb_tres_list_from_string() in common/slurmdb_defs.c for an example of how that's done internally, but you can probably skip building a separate list and just scan the string for (comma or start of string)tres_num=value_num(comma or end of string) to pick out a single value.

- Tim

Reply via email to