diff options
-rwxr-xr-x | lorry-controller-remove-old-jobs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lorry-controller-remove-old-jobs b/lorry-controller-remove-old-jobs index 677e0cd..94ad71b 100755 --- a/lorry-controller-remove-old-jobs +++ b/lorry-controller-remove-old-jobs @@ -26,14 +26,16 @@ import cliapp class JobInfo(object): - def __init__(self, job_id, exit_code, exit_timestamp): + def __init__(self, job_id, exit_code, exit_timestamp, start_timestamp): self.job_id = job_id self.exit_code = exit_code self.exit_timestamp = exit_timestamp + self.start_timestamp = start_timestamp def __repr__(self): - return 'JobInfo(%s,%s,%s)' % ( - self.job_id, self.exit_code, self.exit_timestamp) + return 'JobInfo(%s,%s,%s,%s)' % ( + self.job_id, self.exit_code, self.exit_timestamp, + self.start_timestamp) class OldJobRemover(cliapp.Application): @@ -108,7 +110,8 @@ class OldJobRemover(cliapp.Application): exit_timestamp = self.parse_timestamp(obj['job_ended']) else: exit_timestamp = None - return JobInfo(job_id, exit_code, exit_timestamp) + start_timestamp = self.parse_timestamp(obj['job_started']) + return JobInfo(job_id, exit_code, exit_timestamp, start_timestamp) def parse_timestamp(self, timestamp): return time.mktime(time.strptime(timestamp, '%Y-%m-%d %H:%M:%S UTC')) |