aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-build-coordinator/client-communication.scm16
-rw-r--r--guix-build-coordinator/datastore/sqlite.scm15
-rw-r--r--scripts/guix-build-coordinator.in14
3 files changed, 44 insertions, 1 deletions
diff --git a/guix-build-coordinator/client-communication.scm b/guix-build-coordinator/client-communication.scm
index 124caab..2453800 100644
--- a/guix-build-coordinator/client-communication.scm
+++ b/guix-build-coordinator/client-communication.scm
@@ -369,6 +369,14 @@
((_ . val)
(string=? val "true"))
(#f 'unset))
+ #:priority->
+ (or (and=> (assq-ref query-parameters 'priority_gt)
+ string->number)
+ 'unset)
+ #:priority-<
+ (or (and=> (assq-ref query-parameters 'priority_lt)
+ string->number)
+ 'unset)
#:after-id
(assq-ref query-parameters 'after_id)
#:limit
@@ -580,6 +588,8 @@
(not-systems '())
(processed 'unset)
(canceled 'unset)
+ (priority-> 'unset)
+ (priority-< 'unset)
(after-id #f)
(limit 1000))
(let ((query-parameters
@@ -621,6 +631,12 @@
'("canceled=true")
'("canceled=false"))
'())
+ ,@(if (number? priority->)
+ (list (simple-format #f "priority_gt=~A" priority->))
+ '())
+ ,@(if (number? priority-<)
+ (list (simple-format #f "priority_lt=~A" priority-<))
+ '())
,@(if after-id
(list (string-append "after_id=" after-id))
'())
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm
index a6c93f3..bf90fc5 100644
--- a/guix-build-coordinator/datastore/sqlite.scm
+++ b/guix-build-coordinator/datastore/sqlite.scm
@@ -1736,6 +1736,8 @@ WHERE uuid = :uuid"
(not-systems '())
(processed 'unset)
(canceled 'unset)
+ (priority-> 'unset)
+ (priority-< 'unset)
(after-id #f)
(limit 1000))
(call-with-worker-thread
@@ -1817,8 +1819,11 @@ SELECT id FROM tags WHERE key = :key"
(not (null? not-tag-expressions))
(not (null? systems))
(not (null? not-systems))
+ (not (eq? priority-> 'unset))
+ (not (eq? priority-< 'unset))
(not (eq? processed 'unset))
- (not (eq? canceled 'unset))))
+ (not (eq? canceled 'unset))
+ after-id))
(statement
(sqlite-prepare
db
@@ -1865,6 +1870,14 @@ LEFT JOIN (
#f "derivations.system_id != ~A"
(db-system->system-id db system)))
not-systems)
+ (if (number? priority->)
+ (list
+ (simple-format #f "priority > ~A" priority->))
+ '())
+ (if (number? priority-<)
+ (list
+ (simple-format #f "priority < ~A" priority-<))
+ '())
(cond
((eq? processed #t) '("processed = 1"))
((eq? processed #f) '("processed = 0"))
diff --git a/scripts/guix-build-coordinator.in b/scripts/guix-build-coordinator.in
index c9e7ee9..937ee4b 100644
--- a/scripts/guix-build-coordinator.in
+++ b/scripts/guix-build-coordinator.in
@@ -188,6 +188,16 @@
(alist-cons 'canceled
(string=? arg "true")
result)))
+ (option '("priority-gt") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'priority->
+ (string->number arg)
+ result)))
+ (option '("priority-lt") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'priority-<
+ (string->number arg)
+ result)))
(option '("after-id") #t #f
(lambda (opt name arg result)
(alist-cons 'after-id
@@ -206,6 +216,8 @@
(not-systems . ())
(processed . 'unset)
(canceled . 'unset)
+ (priority-> . 'unset)
+ (priority-< . 'unset)
(limit . 1000)))
(define %build-cancel-options
@@ -479,6 +491,8 @@ canceled?: ~A
#:not-systems (assq-ref opts 'not-systems)
#:processed (assq-ref opts 'processed)
#:canceled (assq-ref opts 'canceled)
+ #:priority-> (assq-ref opts 'priority->)
+ #:priority-< (assq-ref opts 'priority-<)
#:after-id (or after-id (assq-ref opts 'after-id))
#:limit (assq-ref opts 'limit))))
(for-each