aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-06-30 18:47:10 +0100
committerChristopher Baines <mail@cbaines.net>2022-06-30 20:50:19 +0100
commit23504e0f01dc1eae05b307e313ba70faaad84be8 (patch)
tree0831e28cd26a1bcb46da02580305901154b21471 /scripts
parent70c83f81db4a6dd9ad94d4ec2b3b3be62bd0f467 (diff)
downloadbuild-coordinator-23504e0f01dc1eae05b307e313ba70faaad84be8.tar
build-coordinator-23504e0f01dc1eae05b307e313ba70faaad84be8.tar.gz
Support processing hook events in parallel
Forcing hooks to be sequential simplifies them, and the implementation, but it doesn't always scale well. I'm particularly thinking about the build-submitted hook and built-success hooks, the processing of which can back up if there's lots of builds being submitted or finishing successfully. This new functionality allows hooks to be processed in parallel, which should allow to manage this more effectively.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/guix-build-coordinator.in29
1 files changed, 20 insertions, 9 deletions
diff --git a/scripts/guix-build-coordinator.in b/scripts/guix-build-coordinator.in
index 1fbcad3..c9e7ee9 100644
--- a/scripts/guix-build-coordinator.in
+++ b/scripts/guix-build-coordinator.in
@@ -327,14 +327,24 @@
arg)
(exit 1)))
result))))
- (map (lambda (hook)
- (option (list (simple-format #f "~A-hook" hook)) #t #f
- (lambda (opt name arg result)
- (alist-cons (symbol-append hook '-hook)
- (read/eval arg)
- (alist-delete (symbol-append hook '-hook)
- result)))))
- %known-hooks)))
+ (append-map
+ (lambda (hook)
+ (list
+ (option (list (simple-format #f "~A-hook" hook)) #t #f
+ (lambda (opt name arg result)
+ (alist-cons (symbol-append hook '-hook)
+ (read/eval arg)
+ (alist-delete (symbol-append hook '-hook)
+ result))))
+ (option (list (simple-format #f "~A-hook-threads" hook)) #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'parallel-hooks
+ `((,hook . ,(string->number arg))
+ ,@(or (assq-ref result 'parallel-hooks)
+ '()))
+ (alist-delete 'parallel-hooks
+ result))))))
+ %known-hooks)))
(define %service-option-defaults
;; Alist of default option values
@@ -851,4 +861,5 @@ tags:
#:update-datastore? (assoc-ref opts 'update-database)
#:pid-file (assq-ref opts 'pid-file)
#:agent-communication-uri (assq-ref opts 'agent-communication)
- #:client-communication-uri (assq-ref opts 'client-communication)))))))
+ #:client-communication-uri (assq-ref opts 'client-communication)
+ #:parallel-hooks (assq-ref opts 'parallel-hooks)))))))