ci,crnm: warning message when a job can't be enabled

Instead of an exception that completely stops the run'n'monitor process, when
a job with a specific status can't be enabled, just log it with a warning.
Don't attempt to enable it again unless it changes the status.

Signed-off-by: Sergi Blanch Torne <sergi.blanch.torne@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39049>
This commit is contained in:
Sergi Blanch Torne
2025-12-20 11:15:10 +01:00
committed by Marge Bot
parent a689ec8676
commit 467dd0b990

View File

@@ -302,11 +302,17 @@ def enable_job(
# Get current attempt number # Get current attempt number
attempt_count = enable_attempts.get((job.id, job.status), 0) attempt_count = enable_attempts.get((job.id, job.status), 0)
# Check if we've exceeded max attempts to avoid infinite loop # Check if we've exceeded max attempts to avoid infinite loop
if attempt_count >= MAX_ENABLE_JOB_ATTEMPTS: if attempt_count == MAX_ENABLE_JOB_ATTEMPTS:
raise RuntimeError( print(
f"[yellow]WARNING: "
f"Maximum enabling attempts ({MAX_ENABLE_JOB_ATTEMPTS}) reached for job {job.name} in {job.status} status" f"Maximum enabling attempts ({MAX_ENABLE_JOB_ATTEMPTS}) reached for job {job.name} in {job.status} status"
f"({link2print(job.web_url, job.id)}). Giving up." f"({link2print(job.web_url, job.id)})."
) )
enable_attempts[(job.id, job.status)] = attempt_count + 1
return False
elif attempt_count > MAX_ENABLE_JOB_ATTEMPTS:
return False
enable_attempts[(job.id, job.status)] = attempt_count + 1 enable_attempts[(job.id, job.status)] = attempt_count + 1
pjob = project.jobs.get(job.id, lazy=True) pjob = project.jobs.get(job.id, lazy=True)