[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Ludovic Courtès |
Date: |
Thu, 28 Sep 2023 06:53:43 -0400 (EDT) |
branch: master
commit 64568e7feed1e17421fe8f361deb2980fcd7e192
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue Sep 26 16:36:31 2023 +0200
database: ‘db-get-builds’ matches ‘db-get-pending-build’ ordering.
That way, the /api/queue endpoint returns something that matches actual
scheduling.
* src/cuirass/database.scm (db-get-builds): Adjust ordering for
‘status+submission-time’.
---
src/cuirass/database.scm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index 7f7d60f..69384b7 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -1385,9 +1385,11 @@ CASE WHEN CAST(:borderlowid AS integer) IS NULL THEN
Builds.id ELSE -Builds.id END DESC"
"stoptime DESC, Builds.id DESC"))
;; With this order, builds in 'running' state (-1) appear
- ;; before those in 'scheduled' state (-2).
+ ;; before those in 'scheduled' state (-2). The remaining criteria
+ ;; match what 'db-get-pending-build' does; this is so that /api/queue
+ ;; returns something that matches actual scheduling.
(('order . 'status+submission-time)
- "Builds.status DESC, Builds.timestamp DESC, Builds.id ASC")
+ "Builds.status DESC, Builds.priority ASC, Builds.timestamp ASC,
Builds.id ASC")
(('order . 'priority+timestamp)
"Builds.priority ASC, Builds.timestamp DESC")
(_ "Builds.id DESC"))))
@@ -1594,6 +1596,8 @@ SELECT derivation FROM Builds WHERE Builds.status <
0;"))))
highest priority (lowest integer value)."
(with-db-worker-thread db
(match (expect-one-row
+ ;; Note: Keep ordering in sync with that of the
+ ;; 'status+submission-time' filter of 'db-get-builds'.
(exec-query/bind db "
WITH pending_dependencies AS
(SELECT Builds.id, count(dep.id) as deps FROM Builds