Skip to content

Active job runtime calculation can be incorrect #1067

@alex-ketch

Description

@alex-ketch

There seems to be an issue with the job.runtime_seconds calculation which causes the progress bar for file conversions to immediately jump to 100%.

hub/manager/jobs/models.py

Lines 870 to 884 in c8bb8dd

@cached_property
def runtime_seconds(self) -> Optional[float]:
"""
Get the runtime in seconds.
"""
if self.runtime is not None:
return self.runtime
elif self.is_active and self.began:
return (timezone.now() - self.began).seconds
elif self.ended and self.began:
return (self.ended - self.began).seconds
else:
return None

In trying to debug locally, I noticed that the timezones were different between the now and began timestamps.
Screenshot 2021-03-10 at 15 52 52

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions