From a34fb6a3694538db8496b3bc599c3e62b9acaca6 Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Wed, 24 Jun 2020 11:27:31 +0200 Subject: [PATCH] worker: fix crash on try_delete_jobs In some circumstances workers try to delete a job which is not created yet. It quits immediately with unhandled exception error. We do not want to allow crashes whatever error happens, because worker can continue working and process other jobs correctly. Also some schedulers might not add corresponding first in suite and last in suite jobs to the reporter, since it is not required. Signed-off-by: Kyr Shatskyy --- teuthology/worker.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/teuthology/worker.py b/teuthology/worker.py index e8d431f2e6..e7c1eb6ef7 100644 --- a/teuthology/worker.py +++ b/teuthology/worker.py @@ -192,7 +192,11 @@ def run_job(job_config, teuth_bin_path, archive_dir, verbose): safe_archive = safepath.munge(job_config['name']) if job_config.get('first_in_suite') or job_config.get('last_in_suite'): if teuth_config.results_server: - report.try_delete_jobs(job_config['name'], job_config['job_id']) + try: + report.try_delete_jobs(job_config['name'], job_config['job_id']) + except Exception as e: + log.warning("Unable to delete job %s, exception occurred: %s", + job_config['job_id'], e) suite_archive_dir = os.path.join(archive_dir, safe_archive) safepath.makedirs('/', suite_archive_dir) args = [ -- 2.39.5