Thanks for the patch. It's committed in:
https://github.com/SchedMD/slurm/commit/dafe2c979499af363253bc527e8f50e175dda57f

Thanks,
Brian

On 1/27/15 2:48 PM, Skouson, Gary B wrote:
We're running 14.03.  I was trying to sort jobs by the time left (--sort="-L") 
and found that things didn't sort correctly.

In src/squeue/sort.c it looks like it's subtracting job_time_used(job1) which is 
in seconds from job1->time_limit, which is in minutes.  The following patch 
gets it to work for me.

-----
Gary Skouson


diff --git a/src/squeue/sort.c b/src/squeue/sort.c
index 4c024a3..70a08d3 100644
--- a/src/squeue/sort.c
+++ b/src/squeue/sort.c
@@ -640,11 +640,11 @@ static int _sort_job_by_time_left(void *void1, void 
*void2)
         if ((job1->time_limit == INFINITE) || (job1->time_limit == NO_VAL))
                 time1 = INFINITE;
         else
-               time1 = job1->time_limit - job_time_used(job1);
+               time1 = job1->time_limit * 60 - job_time_used(job1);
         if ((job2->time_limit == INFINITE) || (job2->time_limit == NO_VAL))
                 time2 = INFINITE;
         else
-               time2 = job2->time_limit - job_time_used(job2);
+               time2 = job2->time_limit * 60 - job_time_used(job2);
         diff = _diff_time(time1, time2);
if (reverse_order)

Reply via email to