Hi,
Am 11.03.2012 um 14:06 schrieb Mohamed Adel:
> I want to print the elapsed time of a job in the epilog.
> I tried to use “`qacct -j <job id> | grep ru_wallclock | cut -d ' ' -f 2`” in
> the epilog script, but I receive “error: job id <> not found”. Obviously this
> is because the information isn’t written in the accounting file when the
> epilog is executed.
Correct. It's only written after the job left the node already.
> I tried to submit background jobs in the epilog to get the elapsed time from
> qacct command. It worked fine at first, then it suddenly stopped!!
> Is there any way to get the wall clock time for a job in the epilog; i.e.
> before the information is written into the accounting file.
You could use `awk`. In the epilog:
qstat -s r | awk -v jobid=$JOB_ID -f runtime
with the awk script "runtime":
BEGIN { actual_time=systime() }
$1 == jobid { running_seconds=actual_time - mktime(substr($6,7,4)"
"substr($6,1,2)" "substr($6,4,2)" " \
substr($7,1,2)"
"substr($7,4,2)" "substr($7,7,2))
starttime_days=int(running_seconds / 86400)
starttime_time=strftime("%T", running_seconds % 86400, 1)
printf("%dd %s\n", starttime_days, starttime_time)
}
Adjust the ouput format to your needs. Should give:
$ qstat -s r | awk -v jobid=$JOB_ID -f runtime
0d 05:23:05
-- Reuti
>
> Thanks in advance,
> madel
>
> _______________________________________________
> users mailing list
> [email protected]
> https://gridengine.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
https://gridengine.org/mailman/listinfo/users