From ad766c3ee3d9f3baea51313a33752bd4acdfb8cd Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Tue, 11 Oct 2022 13:10:53 -0600 Subject: [PATCH] dispatcher: Return the highest of the jobs' RCs This is so that ceph-devstack can report job failures Signed-off-by: Zack Cerza --- teuthology/dispatcher/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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]]: -- 2.47.3