[llvm] [CI] Don't count canceled buildkite builds (PR #132015)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 19 05:39:46 PDT 2025


https://github.com/Keenuts created https://github.com/llvm/llvm-project/pull/132015

We don't count canceled jobs on GCP, so we shouldn't count canceled jobs on Buildkite neither.

>From 4b7acc57b82748ee347123497633f2416993473a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= <brioche at google.com>
Date: Wed, 19 Mar 2025 13:33:02 +0100
Subject: [PATCH] [CI] Don't count canceled buildkite builds
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

We don't count canceled jobs on GCP, so we shouldn't
count canceled jobs on Buildkite neither.

Signed-off-by: Nathan Gauër <brioche at google.com>
---
 .ci/metrics/metrics.py | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/.ci/metrics/metrics.py b/.ci/metrics/metrics.py
index 511b1866ed487..8069e262a68ec 100644
--- a/.ci/metrics/metrics.py
+++ b/.ci/metrics/metrics.py
@@ -215,25 +215,14 @@ def buildkite_get_metrics(
             if job["name"] not in BUILDKITE_WORKFLOW_TO_TRACK:
                 continue
 
+            # Don't count canceled jobs.
+            if job["canceled_at"]:
+                continue
+
             created_at = dateutil.parser.isoparse(job["created_at"])
-            scheduled_at = (
-                created_at
-                if job["scheduled_at"] is None
-                else dateutil.parser.isoparse(job["scheduled_at"])
-            )
-            started_at = (
-                scheduled_at
-                if job["started_at"] is None
-                else dateutil.parser.isoparse(job["started_at"])
-            )
-            if job["canceled_at"] is None:
-                finished_at = (
-                    started_at
-                    if job["finished_at"] is None
-                    else dateutil.parser.isoparse(job["finished_at"])
-                )
-            else:
-                finished_at = dateutil.parser.isoparse(job["canceled_at"])
+            scheduled_at = dateutil.parser.isoparse(job["scheduled_at"])
+            started_at = dateutil.parser.isoparse(job["started_at"])
+            finished_at = dateutil.parser.isoparse(job["finished_at"])
 
             job_name = BUILDKITE_WORKFLOW_TO_TRACK[job["name"]]
             queue_time = (started_at - scheduled_at).seconds



More information about the llvm-commits mailing list