aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-05-27 14:32:44 +0100
committerChristopher Baines <mail@cbaines.net>2022-05-27 14:32:44 +0100
commitba75cbe2df5abe3d4ce51d30740c0a98e1ababa3 (patch)
treead006e89641a6a8fc684d915c037dead1b390455 /scripts
parent7c3d334eaaa002a60f1fdfea475a733d9ee221fa (diff)
downloadbuild-coordinator-ba75cbe2df5abe3d4ce51d30740c0a98e1ababa3.tar
build-coordinator-ba75cbe2df5abe3d4ce51d30740c0a98e1ababa3.tar.gz
Add a crude way of overriding the hardcoded priorities
Diffstat (limited to 'scripts')
-rw-r--r--scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in48
1 files changed, 29 insertions, 19 deletions
diff --git a/scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in b/scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in
index dc28008..c70c892 100644
--- a/scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in
+++ b/scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in
@@ -292,6 +292,11 @@
(or (assq-ref result 'branches)
'()))
(alist-delete 'branches result))))
+ (option '("priority") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'priority
+ (string->number arg)
+ (alist-delete 'priority result))))
(option '("threads") #t #f
(lambda (opt name arg result)
(alist-cons 'threads
@@ -346,25 +351,30 @@
lvl
str)))))
- (define (priority-for-derivation type system target)
- (cond
- ((eq? type 'channel-instance)
- (if (and (string=? system "x86_64-linux")
- (string=? target "none"))
- 1000
- 500))
- ((eq? type 'package)
- (cond
- ((and (string=? system "x86_64-linux")
- (string=? target "none"))
- 500)
- ((and (string=? system "aarch64-linux")
- (string=? target "none"))
- 500)
- (else
- 0)))
- (else
- 0)))
+ (define priority-for-derivation
+ (or (and=> (assq-ref opts 'priority)
+ (lambda (fixed-priority)
+ (const fixed-priority)))
+
+ (lambda (type system target)
+ (cond
+ ((eq? type 'channel-instance)
+ (if (and (string=? system "x86_64-linux")
+ (string=? target "none"))
+ 1000
+ 500))
+ ((eq? type 'package)
+ (cond
+ ((and (string=? system "x86_64-linux")
+ (string=? target "none"))
+ 500)
+ ((and (string=? system "aarch64-linux")
+ (string=? target "none"))
+ 500)
+ (else
+ 0)))
+ (else
+ 0)))))
(add-handler! lgr port-log)
(open-log! lgr)