From f2ab8d637cd1921c7d383032b36a89043de8ed1e Mon Sep 17 00:00:00 2001 From: Stanislav Zaprudskiy Date: Tue, 17 Jan 2023 13:28:34 +0100 Subject: [PATCH] Do not discard jobs w/ .started=None --- awx/main/management/commands/disable_instance.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/awx/main/management/commands/disable_instance.py b/awx/main/management/commands/disable_instance.py index 6e54912928..a0f7bfef10 100644 --- a/awx/main/management/commands/disable_instance.py +++ b/awx/main/management/commands/disable_instance.py @@ -44,11 +44,10 @@ class AWXInstance: def jobs_pretty(self): jobs = [] for j in self.jobs(): - if not j.started: - continue + job_started = j.started if j.started else now() # similar calculation of `elapsed` as the corresponding serializer # does - td = now() - j.started + td = now() - job_started elapsed = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / (10**6 * 1.0) elapsed = float(elapsed) details = dict( @@ -76,7 +75,7 @@ class Command(BaseCommand): @staticmethod def ge_1(arg): if arg == "inf": - return float(arg) + return float("inf") int_arg = int(arg) if int_arg < 1: