How to get an accurate elapsed time of jobs

Hello All,

I wonder where can I get the accurate elapsed time of a job.
(or a real end time of a job. if I can get the real end time, I can use job_endtime - job_starttime as the job’s elapsed time)

After submitting array job in PBS, I execute qdel some of the subjobs before they are finished.
I expected those cancelled subjobs should have a eariler mtime.(I use qstat -xf as the query command)
But when all of the subjobs are finished, the jobs those I cancelled get the same mtime with other subjobs.

look forward the reply. Thank you very much.

In general, not from the pbs attributes, within your script you can have

echo “start ---- $(date +%Y%m%d_%H%M%S)”
main_execution_script(s)
echo “end — $(date +%Y%m%d_%H%M%S)”

I think resources_used.walltime should work … you can also look at a job’s end time from its accounting log E record, the field “end” stores the timestamp for when it ended … there’s a different E record printed for each subjob so you can also use the timestamp of the E record itself

thank you so much. but the job scripts are written by someone else. I cannot rely on the jobs’ log.

Thank you very much.

  1. resources_used.walltime is not exist in subjobs output. it seems the walltime only displayed in normally finished subjobs.
  2. I think accounting seems more suitable for me. Next I will work on how to get the accounting log. maybe I need to install some necessary package. Now it seems no command like qacct or pbs_accounting on my server.

You can look into execjob_epilogue and execjob_prologue hooks

The accounting logs are created in openpbs at this location $PBS_HOME/server_priv/accounting/YYYYMMDD

The accounting logs are human readable text files.

Please let us know the version of openpbs you are running.