From 1af61263df86ef2e710e4eba9d6eb9b358f276a0 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Mon, 3 Apr 2023 16:07:37 -0600 Subject: [PATCH] worker.prep_job: Skip job if ls_remote fails This is preferable to letting the dispatcher die. Signed-off-by: Zack Cerza --- teuthology/worker.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/teuthology/worker.py b/teuthology/worker.py index b23b6120a..2e5a57c54 100644 --- a/teuthology/worker.py +++ b/teuthology/worker.py @@ -156,7 +156,15 @@ def prep_job(job_config, log_file_path, archive_dir): teuthology_sha1 = job_config.get('teuthology_sha1') if not teuthology_sha1: repo_url = repo_utils.build_git_url('teuthology', 'ceph') - teuthology_sha1 = repo_utils.ls_remote(repo_url, teuthology_branch) + try: + teuthology_sha1 = repo_utils.ls_remote(repo_url, teuthology_branch) + except Exception as exc: + log.exception(f"Could not get teuthology sha1 for branch {teuthology_branch}") + report.try_push_job_info( + job_config, + dict(status='dead', failure_reason=str(exc)) + ) + raise SkipJob() if not teuthology_sha1: reason = "Teuthology branch {} not found; marking job as dead".format(teuthology_branch) log.error(reason) -- 2.47.3