ci/ci_run_n_monitor: merge print_job_status_change with print_job_status

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25473>
This commit is contained in:
Helen Koike
2023-09-29 18:43:24 -03:00
committed by Marge Bot
parent 7f6c339740
commit 633c08688b

View File

@@ -50,7 +50,7 @@ STATUS_COLORS = {
COMPLETED_STATUSES = ["success", "failed"] COMPLETED_STATUSES = ["success", "failed"]
def print_job_status(job) -> None: def print_job_status(job, new_status=False) -> None:
"""It prints a nice, colored job status with a link to the job.""" """It prints a nice, colored job status with a link to the job."""
if job.status == "canceled": if job.status == "canceled":
return return
@@ -61,23 +61,7 @@ def print_job_status(job) -> None:
+ URL_START + URL_START
+ f"{job.web_url}\a{job.name}" + f"{job.web_url}\a{job.name}"
+ URL_END + URL_END
+ f" :: {job.status}" + (f" has new status: {job.status}" if new_status else f" :: {job.status}")
+ Style.RESET_ALL
)
def print_job_status_change(job) -> None:
"""It reports job status changes."""
if job.status == "canceled":
return
print(
STATUS_COLORS[job.status]
+ "🗘 job "
+ URL_START
+ f"{job.web_url}\a{job.name}"
+ URL_END
+ f" has new status: {job.status}"
+ Style.RESET_ALL + Style.RESET_ALL
) )
@@ -117,17 +101,13 @@ def monitor_pipeline(
stress_status_counter[job.name][job.status] += 1 stress_status_counter[job.name][job.status] += 1
retry_job(project, job) retry_job(project, job)
if job.status not in target_statuses[job.id]: print_job_status(job, job.status not in target_statuses[job.id])
print_job_status_change(job) target_statuses[job.id] = job.status
target_statuses[job.id] = job.status
else:
print_job_status(job)
continue continue
# all jobs # all jobs
if job.status not in statuses[job.id]: if job.status not in statuses[job.id]:
print_job_status_change(job) print_job_status(job, True)
statuses[job.id] = job.status statuses[job.id] = job.status
# dependencies and cancelling the rest # dependencies and cancelling the rest