]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
dispatcher: Return the highest of the jobs' RCs 1860/head
authorZack Cerza <zack@redhat.com>
Tue, 11 Oct 2022 19:10:53 +0000 (13:10 -0600)
committerZack Cerza <zack@redhat.com>
Tue, 27 Jun 2023 18:43:53 +0000 (12:43 -0600)
This is so that ceph-devstack can report job failures

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/dispatcher/__init__.py

index ddc0054652e71e9360de1c6719779f7c5f15328d..cb916ba513ecee0084c06b15156ad2faccbf78d9 100644 (file)
@@ -107,6 +107,7 @@ def main(args):
 
     keep_running = True
     job_procs = set()
+    worst_returncode = 0
     while keep_running:
         # Check to see if we have a teuthology-results process hanging around
         # and if so, read its return code so that it can exit.
@@ -121,7 +122,11 @@ def main(args):
             stop()
 
         load_config()
-        job_procs = set(filter(lambda p: p.poll() is None, job_procs))
+        for proc in list(job_procs):
+            rc = proc.poll()
+            if rc is not None:
+                worst_returncode = max([worst_returncode, rc])
+                job_procs.remove(proc)
         job = connection.reserve(timeout=60)
         if job is None:
             if exit_on_empty_queue and not job_procs:
@@ -194,11 +199,7 @@ def main(args):
         except Exception:
             log.exception("Saw exception while trying to delete job")
 
-    returncodes = set([0])
-    for proc in job_procs:
-        if proc.returncode is not None:
-            returncodes.add(proc.returncode)
-    return max(returncodes)
+    return worst_returncode
 
 
 def find_dispatcher_processes() -> Dict[str, List[psutil.Process]]: