Fix Job.elapsed()

This commit is contained in:
allegroai 2020-05-31 12:07:12 +03:00
parent f86198bbe5
commit 38230626c2

View File

@ -105,7 +105,9 @@ class TrainsJob(object):
if not self.task_started and str(self.task.status) != Task.TaskStatusEnum.in_progress: if not self.task_started and str(self.task.status) != Task.TaskStatusEnum.in_progress:
return -1 return -1
self.task_started = True self.task_started = True
return (datetime.now() - self.task.data.started).timestamp() if not self.task.data.started:
return -1
return (datetime.now(tz=self.task.data.started.tzinfo) - self.task.data.started).total_seconds()
def iterations(self): def iterations(self):
# type: () -> int # type: () -> int