From: Zack Cerza Date: Tue, 11 Oct 2022 19:10:53 +0000 (-0600) Subject: dispatcher: Return the highest of the jobs' RCs X-Git-Tag: 1.2.0~97^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1860%2Fhead;p=teuthology.git dispatcher: Return the highest of the jobs' RCs This is so that ceph-devstack can report job failures Signed-off-by: Zack Cerza --- diff --git a/teuthology/dispatcher/__init__.py b/teuthology/dispatcher/__init__.py index ddc005465..cb916ba51 100644 --- a/teuthology/dispatcher/__init__.py +++ b/teuthology/dispatcher/__init__.py @@ -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]]: