ci/ci_run_n_monitor: simplify with defaultdict
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:
@@ -98,8 +98,8 @@ def monitor_pipeline(
|
|||||||
stress: bool,
|
stress: bool,
|
||||||
) -> tuple[Optional[int], Optional[int]]:
|
) -> tuple[Optional[int], Optional[int]]:
|
||||||
"""Monitors pipeline and delegate canceling jobs"""
|
"""Monitors pipeline and delegate canceling jobs"""
|
||||||
statuses = {}
|
statuses: dict[int, str] = defaultdict(str)
|
||||||
target_statuses = {}
|
target_statuses: dict[int, str] = defaultdict(str)
|
||||||
stress_status_counter = defaultdict(lambda: defaultdict(int))
|
stress_status_counter = defaultdict(lambda: defaultdict(int))
|
||||||
|
|
||||||
if target_job:
|
if target_job:
|
||||||
@@ -117,9 +117,7 @@ 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.id not in target_statuses) or (
|
if job.status not in target_statuses[job.id]:
|
||||||
job.status not in target_statuses[job.id]
|
|
||||||
):
|
|
||||||
print_job_status_change(job)
|
print_job_status_change(job)
|
||||||
target_statuses[job.id] = job.status
|
target_statuses[job.id] = job.status
|
||||||
else:
|
else:
|
||||||
@@ -128,7 +126,7 @@ def monitor_pipeline(
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# all jobs
|
# all jobs
|
||||||
if (job.id not in statuses) or (job.status not in statuses[job.id]):
|
if job.status not in statuses[job.id]:
|
||||||
print_job_status_change(job)
|
print_job_status_change(job)
|
||||||
statuses[job.id] = job.status
|
statuses[job.id] = job.status
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user