mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -02:30
Fix elapsed time on job showing incorrect value
- job elapsed time showed 0.0, during and after the job run
This commit is contained in:
@@ -842,15 +842,16 @@ class UnifiedJob(
|
||||
if 'finished' not in update_fields:
|
||||
update_fields.append('finished')
|
||||
|
||||
if self.elapsed is None:
|
||||
self.elapsed = 0.0
|
||||
if 'elapsed' not in update_fields:
|
||||
update_fields.append('elapsed')
|
||||
|
||||
# If we have a start and finished time, and haven't already calculated
|
||||
# out the time that elapsed, do so.
|
||||
if self.started and self.finished and not self.elapsed:
|
||||
if self.started and self.finished and self.elapsed == 0.0:
|
||||
td = self.finished - self.started
|
||||
elapsed = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10 ** 6) / (10 ** 6 * 1.0)
|
||||
else:
|
||||
elapsed = 0.0
|
||||
if self.elapsed != elapsed:
|
||||
self.elapsed = str(elapsed)
|
||||
self.elapsed = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10 ** 6) / (10 ** 6 * 1.0)
|
||||
if 'elapsed' not in update_fields:
|
||||
update_fields.append('elapsed')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user