Module: Mesa
Branch: main
Commit: 7f6c339740b9c69f438b00e45af2887030c95571
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f6c339740b9c69f438b00e45af2887030c95571

Author: Helen Koike <[email protected]>
Date:   Fri Sep 29 18:41:19 2023 -0300

ci/ci_run_n_monitor: simplify with defaultdict

Signed-off-by: Helen Koike <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25473>

---

 bin/ci/ci_run_n_monitor.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/bin/ci/ci_run_n_monitor.py b/bin/ci/ci_run_n_monitor.py
index d06f1768dc3..92a26eb4e20 100755
--- a/bin/ci/ci_run_n_monitor.py
+++ b/bin/ci/ci_run_n_monitor.py
@@ -98,8 +98,8 @@ def monitor_pipeline(
     stress: bool,
 ) -> tuple[Optional[int], Optional[int]]:
     """Monitors pipeline and delegate canceling jobs"""
-    statuses = {}
-    target_statuses = {}
+    statuses: dict[int, str] = defaultdict(str)
+    target_statuses: dict[int, str] = defaultdict(str)
     stress_status_counter = defaultdict(lambda: defaultdict(int))
 
     if target_job:
@@ -117,9 +117,7 @@ def monitor_pipeline(
                     stress_status_counter[job.name][job.status] += 1
                     retry_job(project, job)
 
-                if (job.id not in target_statuses) or (
-                    job.status not in target_statuses[job.id]
-                ):
+                if job.status not in target_statuses[job.id]:
                     print_job_status_change(job)
                     target_statuses[job.id] = job.status
                 else:
@@ -128,7 +126,7 @@ def monitor_pipeline(
                 continue
 
             # 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)
                 statuses[job.id] = job.status
 

Reply via email to