aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-05-02 16:06:41 +0200
committerChristopher Baines <mail@cbaines.net>2023-05-02 16:06:41 +0200
commit98430df5d0730818aa6eeb72ec598c523756840e (patch)
tree7cabc08edf7faf0ca6473e4b2dc99ea4dcdedd46
parent5a17584c6a0dcf2fb05817c53ed005b6ee5b5306 (diff)
downloadbuild-coordinator-98430df5d0730818aa6eeb72ec598c523756840e.tar
build-coordinator-98430df5d0730818aa6eeb72ec598c523756840e.tar.gz
Simplify starting the build coordinator
This code is used in the Guix system service, and this simplification will reduce the complexity there and reduce the need to change it in the future.
-rw-r--r--guix-build-coordinator/coordinator.scm20
-rw-r--r--scripts/guix-build-coordinator.in11
2 files changed, 16 insertions, 15 deletions
diff --git a/guix-build-coordinator/coordinator.scm b/guix-build-coordinator/coordinator.scm
index 7f28f13..04cb498 100644
--- a/guix-build-coordinator/coordinator.scm
+++ b/guix-build-coordinator/coordinator.scm
@@ -315,12 +315,20 @@
(define (build-coordinator-get-state-id build-coordinator)
((build-coordinator-get-state-id-proc build-coordinator)))
-(define* (make-build-coordinator #:key datastore hooks
- (metrics-registry (make-metrics-registry
- #:namespace
- "guixbuildcoordinator"))
- (allocation-strategy
- basic-build-allocation-strategy))
+(define* (make-build-coordinator
+ #:key
+ database-uri-string
+ (metrics-registry
+ (make-metrics-registry
+ #:namespace
+ "guixbuildcoordinator"))
+ (datastore
+ (database-uri->datastore
+ database-uri-string
+ #:metrics-registry metrics-registry))
+ hooks
+ (allocation-strategy
+ basic-build-allocation-strategy))
(and (or (list? hooks)
(begin
(simple-format
diff --git a/scripts/guix-build-coordinator.in b/scripts/guix-build-coordinator.in
index 8199896..f873b2c 100644
--- a/scripts/guix-build-coordinator.in
+++ b/scripts/guix-build-coordinator.in
@@ -992,13 +992,7 @@ tags:
(exit 1))
- (let* ((metrics-registry (make-metrics-registry
- #:namespace
- "guixbuildcoordinator"))
- (datastore (database-uri->datastore
- (assq-ref opts 'database)
- #:metrics-registry metrics-registry))
- (hooks (filter-map
+ (let* ((hooks (filter-map
(lambda (name)
(and=> (assq-ref opts (symbol-append name '-hook))
(lambda (value)
@@ -1010,9 +1004,8 @@ tags:
((name . _) (assq-ref hooks name)))
%default-hooks)))
(build-coordinator (make-build-coordinator
- #:datastore datastore
+ #:database-uri-string (assq-ref opts 'database)
#:hooks hooks-with-defaults
- #:metrics-registry metrics-registry
#:allocation-strategy
(assq-ref opts 'allocation-strategy))))