aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-10-08 21:02:33 +0100
committerChristopher Baines <mail@cbaines.net>2021-10-08 21:02:33 +0100
commit76d129dc19cc0e14441ae3a74bbc44e3be570b21 (patch)
treeb04768991d9b34a816fdafaf0189722963f66667
parent0bb8aef259374d925fb8d65346fa4c48254d95a3 (diff)
downloadbuild-coordinator-76d129dc19cc0e14441ae3a74bbc44e3be570b21.tar
build-coordinator-76d129dc19cc0e14441ae3a74bbc44e3be570b21.tar.gz
Support queuing builds in parallel
At least by system+target, as this can help when you're queuing builds for a bunch of systems and targets.
-rw-r--r--scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in25
1 files changed, 15 insertions, 10 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 0adb64c..9536fed 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
@@ -29,6 +29,7 @@
(srfi srfi-11)
(srfi srfi-37)
(ice-9 match)
+ (ice-9 threads)
(ice-9 textual-ports)
(rnrs bytevectors)
(json)
@@ -142,11 +143,12 @@
(assoc-ref data "derivations")))))
(define (record-derivations-as-processed derivations)
- (for-each (lambda (derivation)
- (hash-set! processed-derivations-hash
- derivation
- #t))
- derivations))
+ (monitor
+ (for-each (lambda (derivation)
+ (hash-set! processed-derivations-hash
+ derivation
+ #t))
+ derivations)))
(define* (submit-build coordinator guix-data-service derivation #:key (priority 0))
(retry-on-error
@@ -196,7 +198,7 @@
#:key (submit-builds-for-channel-instances?
#t))
(simple-format #t "looking at revision ~A\n" commit)
- (for-each
+ (par-for-each
(match-lambda
((system . target)
(when (string=? target "none")
@@ -216,10 +218,13 @@
(let ((unprocessed-package-derivations
(filter (lambda (derivation)
(not (hash-ref processed-derivations-hash derivation)))
- (package-derivations-for-commit guix-data-service
- commit
- #:system system
- #:target target))))
+ ;; Only request derivations in one thread at a time, just
+ ;; in cause doing this in parallel could lead to timeouts
+ (monitor
+ (package-derivations-for-commit guix-data-service
+ commit
+ #:system system
+ #:target target)))))
(for-each (lambda (derivation)
(submit-build coordinator