[projects/pld-builder.new] queue.html: mark a build much longer than on the other builders

arekm arekm at pld-linux.org
Thu Nov 12 12:09:39 CET 2026


commit 7b80daaac1b13ddef77763ebbbff4c34f46f6324
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Nov 12 12:04:58 2026 +0100

    queue.html: mark a build much longer than on the other builders
    
    The bin builders are VMs on one machine and build a package in about
    the same time; a build that takes much longer on one of them means
    something drags on there. Its duration gets an orange background when
    it is a fifth longer than the median of the builds done in its row,
    dark orange when twice as long, and never for less than a minute more,
    as short builds differ by seconds. A build still running is compared
    too, so a stuck one shows. The src builder, which runs a command on
    another machine, and failed builds, which may stop at any point, are
    left out. script.js does it, as the time of a running build grows.

 PLD_Builder/queue_html.py |  9 +++++++--
 PLD_Builder/script.js     | 24 ++++++++++++++++++++++++
 PLD_Builder/style.css     |  9 +++++++++
 3 files changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/PLD_Builder/queue_html.py b/PLD_Builder/queue_html.py
index 870b15c..fc859b2 100644
--- a/PLD_Builder/queue_html.py
+++ b/PLD_Builder/queue_html.py
@@ -212,8 +212,12 @@ def builder_html(batch, name, request_id):
     end = batch.builders_build_end.get(name)
 
     span = took = log = about = ""
+    seconds = ""
     if start and end:
         span, took = f'{clock(start)} → {clock(end)}', duration(end - start)
+        # what script.js compares the other builders with; a failed build may stop at any point
+        if status.startswith("OK") or status == "UPLOADING":
+            seconds = f" data-s={int(end - start)}"
         about = f"build {exact(start)} → {exact(end)}, sending to ftp not counted"
     elif start:
         span, took = f'{clock(start)} → …', running_since(start)
@@ -227,7 +231,7 @@ def builder_html(batch, name, request_id):
     if is_final(status) and not status.startswith("SKIP"):
         log = f'<a class=log href="{escape(build_log(batch, name, status, request_id))}">log</a>'
     # right after the status: "OK (2m 12s, log)"
-    more = ", ".join(([f"<b class=took>{took}</b>"] if took else []) + ([log] if log else []))
+    more = ", ".join(([f"<b class=took{seconds}>{took}</b>"] if took else []) + ([log] if log else []))
     more = f" ({more})" if more else ""
     title = f' title="{escape(about)}"' if about else ""
     # the src builder is not one of the columns of the bin builders
@@ -277,7 +281,8 @@ LEGEND = """<h2>How to read a request</h2>
 </div>
 <p class=note>Start and end: from the builder taking the package (fetching the src.rpm, installing
 BuildRequires, rpmbuild) to its result; sending the rpms to ftp is not counted. A tooltip gives them to the second.
-The stripe on the left is red when anything failed, yellow while something waits or builds, green when
+A duration <b class="took slow">on orange</b> is a fifth longer than on the other builders, <b class="took slower">on dark orange</b>
+twice as long, and at least a minute either way. The stripe on the left is red when anything failed, yellow while something waits or builds, green when
 all is done. Times are in {zone}.</p>
 </section>
 """
diff --git a/PLD_Builder/script.js b/PLD_Builder/script.js
index 538f28e..089efce 100644
--- a/PLD_Builder/script.js
+++ b/PLD_Builder/script.js
@@ -19,6 +19,30 @@ document.querySelectorAll('time.since').forEach(function(el) {
 	el.textContent = elapsed(el);
 });
 
+// a build much longer than the same one on the other builders: something drags on there
+document.querySelectorAll('.builders').forEach(function(row) {
+	var builds = [];
+	// the src builder runs a command on another machine
+	row.querySelectorAll('.builder:not(.src) .took').forEach(function(el) {
+		var since = el.querySelector('time.since');
+		if (since) builds.push({el: el, s: (Date.now() - new Date(since.getAttribute('datetime'))) / 1000});
+		else if (el.dataset.s) builds.push({el: el, s: Number(el.dataset.s), done: true});
+	});
+	// the median of the builds done: of three, two slow ones make the fast one the odd one out
+	var done = builds.filter(function(b) { return b.done; }).map(function(b) { return b.s; }).sort(function(x, y) { return x - y; });
+	if (!done.length) return;
+	var mid = done.length / 2;
+	var usual = done.length % 2 ? done[Math.floor(mid)] : (done[mid - 1] + done[mid]) / 2;
+	builds.forEach(function(b) {
+		// short builds differ by seconds, which says nothing
+		if (b.s - usual < 60) return;
+		var ratio = Number((b.s / usual).toFixed(1));
+		if (ratio < 1.2) return;
+		b.el.classList.add(ratio < 2 ? 'slow' : 'slower');
+		b.el.title = ratio + '\u00d7 the median of the builders, ' + span(usual);
+	});
+});
+
 // the legend is a request with no id
 var requests = document.querySelectorAll('.request[id]');
 var search = document.getElementById('search');
diff --git a/PLD_Builder/style.css b/PLD_Builder/style.css
index 5cda513..a60f353 100644
--- a/PLD_Builder/style.css
+++ b/PLD_Builder/style.css
@@ -276,6 +276,15 @@ h2 {
 	white-space: nowrap;
 }
 
+/* longer than on the other builders: see script.js */
+.took.slow, .took.slower {
+	border-radius: 3px;
+	padding: 0 4px;
+}
+
+.took.slow { background: #ffcc80; }
+.took.slower { background: #ff7043; }
+
 .log {
 	font-size: 12px;
 }
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/7b80daaac1b13ddef77763ebbbff4c34f46f6324



More information about the pld-cvs-commit mailing list