From c2613e4431ced222f73161edc94ecd3bbe4babbd Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 23 Sep 2012 09:12:06 +0100 Subject: Add script to list the time it takes to run each job --- job-times | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 job-times (limited to 'job-times') diff --git a/job-times b/job-times new file mode 100755 index 0000000..7cd4b35 --- /dev/null +++ b/job-times @@ -0,0 +1,26 @@ +#!/usr/bin/python + +import cliapp +import time + +class ListJobTimes(cliapp.Application): + + def process_input_line(self, filename, line): + words = line.split() + if len(words) < 6 or words[2] != 'INFO': + pass + elif words[3] == 'Starting' and words[4] == 'job': + self.started = self.parse_time(words[0], words[1]) + self.jobid = words[5] + elif words[3] == 'Finished' and words[4] == 'job': + ended = self.parse_time(words[0], words[1]) + self.output.write('%.1f %s\n' % (ended - self.started, self.jobid)) + self.started = None + self.jobid = None + + def parse_time(self, dt, tm): + t = time.strptime('%s %s' % (dt, tm), '%Y-%m-%d %H:%M:%S') + return time.mktime(t) + +ListJobTimes().run() + -- cgit v1.2.1