From 23504e0f01dc1eae05b307e313ba70faaad84be8 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 30 Jun 2022 18:47:10 +0100 Subject: 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. --- scripts/guix-build-coordinator.in | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'scripts') 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))))))) -- cgit v1.2.3