If you are looking to use the C API for this then showq may be a good guide: https://github.com/fasrc/slurm_showq  The -o option orders the pending queue in priority order.

If you are looking at native slurm commands, sprio can print out the current priority breakdown of any job and filter by partition, then you can reorder based on that.  squeue also can print out current priority. You might also look at the --priority option: https://slurm.schedmd.com/squeue.html#OPT_priority

-Paul Edmon-

On 10/29/24 9:33 AM, Bhaskar Chakraborty via slurm-users wrote:
Hello,

Is there any DS in slurmctld which portrays the dynamic relative priority of pending jobs?

We are trying to use slurm for developing a scheduling solution and 1 of the problems we face at the outset is how to determine
the order of scheduling for pending jobs.

One option is to find scheduling iteration window begin & close pointers & cache the job ids as seen in order & then make them the priority order at that point of time.

( This means for 500 pending jobs, say, if we can find which are the slurmctld calls which mark the beginning & end of a sched iteration then we can use the scheduling order
of jobs as the relative priority order for that period of time, of course it may change depending on fairshare, user initiated priority modification etc. )

A concrete existing data structure showing the dynamic priority itself from slurmctld would be handy.

Help appreciated.

Thanks!

Bhaskar.