Ticket 13025 - Recording PendingTime for analysis
Summary: Recording PendingTime for analysis
Status: RESOLVED INFOGIVEN
Alias: None
Product: Slurm
Classification: Unclassified
Component: Accounting (show other tickets)
Version: 21.08.2
Hardware: Linux Linux
: 4 - Minor Issue
Assignee: Oriol Vilarrubi
QA Contact:
URL:
Depends on:
Blocks:
 
Reported: 2021-12-13 14:32 MST by Gordon Dexter
Modified: 2024-06-26 11:22 MDT (History)
1 user (show)

See Also:
Site: Johns Hopkins Univ. HLTCOE
Slinky Site: ---
Alineos Sites: ---
Atos/Eviden Sites: ---
Confidential Site: ---
Coreweave sites: ---
Cray Sites: ---
DS9 clusters: ---
Google sites: ---
HPCnow Sites: ---
HPE Sites: ---
IBM Sites: ---
NOAA SIte: ---
NoveTech Sites: ---
Nvidia HWinf-CS Sites: ---
OCF Sites: ---
Recursion Pharma Sites: ---
SFW Sites: ---
SNIC sites: ---
Tzag Elita Sites: ---
Linux Distro: ---
Machine Name:
CLE Version:
Version Fixed:
Target Release: ---
DevPrio: ---
Emory-Cloud Sites: ---


Attachments

Note You need to log in before you can comment on or make changes to this ticket.
Description Gordon Dexter 2021-12-13 14:32:40 MST
As part of procurement planning we'd like to have some visibility into how long jobs wait in the queue before they are run.  This would help us answer questions like "How long, on average, does a job wait for a T4?"

The PendingTime attribute seems to provide this but is only available via squeue, not sacct, making it unsuited for long-term stats.

Is there some way to access the PendingTime via sacct?  Or if not, is there some way to add a field in sacct that a prolog script can write to?
Comment 1 Oriol Vilarrubi 2021-12-14 03:44:32 MST
Hi Gordon,

Pending time is just a calculated difference between the submittime and the actual time if pending, or the start time if running.
If you want to get that value from sacct you can do it very easily:
  
I've submitted a job that was waiting in queue for 81 seconds:
[jvilarru@centos ~]$ squeue -O JobId,PendingTime
JOBID               PENDING_TIME        
43                  81                  

Then with sacct you can get the submittime and the start time and subtract them.

Let's take this job 43 for example:

sacct -X -j 43 -o Submit,Start
             Submit               Start 
------------------- ------------------- 
2021-12-14T11:11:27 2021-12-14T11:12:48 

This output can be converted so that it is easily subtractable:

SLURM_TIME_FORMAT="%s" sacct --noheader -P -X -j 43 -o Submit,Start
1639476687|1639476768

And then you can do it for example with awk:
SLURM_TIME_FORMAT="%s" sacct --noheader -P -X -j 43 -o Submit,Start | awk -F'|' '{ print $2-$1}'
81

You can do that for multiple jobs too if you specify them comma separated in the -j, or you can also specify other filters like using the state of the jobs, start and end time, etc...

Greetings
Comment 2 Gordon Dexter 2021-12-14 13:02:01 MST
Thank you.  This should do the trick.