diff options
author | Christopher Baines <mail@cbaines.net> | 2022-07-07 18:23:53 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-07-07 18:23:53 +0100 |
commit | 49ea0deba5d985812d52836f4aa193408be698c8 (patch) | |
tree | f28a566aa552bcadc991c336c197fe6f6229ea7d /guix-build-coordinator | |
parent | cfd3f8d49aa16772b9b62cc24aff6c1e68b27f63 (diff) | |
download | build-coordinator-49ea0deba5d985812d52836f4aa193408be698c8.tar build-coordinator-49ea0deba5d985812d52836f4aa193408be698c8.tar.gz |
Support listing builds by priority
Diffstat (limited to 'guix-build-coordinator')
-rw-r--r-- | guix-build-coordinator/client-communication.scm | 16 | ||||
-rw-r--r-- | guix-build-coordinator/datastore/sqlite.scm | 15 |
2 files changed, 30 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")) |