diff options
author | Christopher Baines <mail@cbaines.net> | 2020-09-16 21:00:41 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-09-16 21:20:00 +0100 |
commit | fadb1cf50eb51cf8c9e06bbcc12f8583cfe0cc07 (patch) | |
tree | ae44d5a2e31d37ce8582bddfe04205fc234c2def /scripts | |
parent | 4f17609b377c128888be6d85af46fb05fe38ce45 (diff) | |
download | build-coordinator-fadb1cf50eb51cf8c9e06bbcc12f8583cfe0cc07.tar build-coordinator-fadb1cf50eb51cf8c9e06bbcc12f8583cfe0cc07.tar.gz |
Create a run-coordinator-service procedure
This is moving in the direction of not having to use the script to start the
service. I think for a Guix service definition, being able to specify some
Guile code directly will be better.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/guix-build-coordinator.in | 60 |
1 files changed, 8 insertions, 52 deletions
diff --git a/scripts/guix-build-coordinator.in b/scripts/guix-build-coordinator.in index 59341cc..1c4f673 100644 --- a/scripts/guix-build-coordinator.in +++ b/scripts/guix-build-coordinator.in @@ -37,7 +37,6 @@ (guix-build-coordinator datastore) (guix-build-coordinator coordinator) (guix-build-coordinator build-allocator) - (guix-build-coordinator agent-messaging http) (guix-build-coordinator client-communication)) (define %base-options @@ -182,8 +181,8 @@ (define %service-option-defaults ;; Alist of default option values - `((agent-communication . "http://0.0.0.0:8745") - (client-communication . "http://127.0.0.1:8746") + `((agent-communication . ,%default-agent-uri) + (client-communication . ,%default-client-uri) (allocation-strategy . ,basic-build-allocation-strategy) (build-submitted-hook . ,default-build-submitted-hook) (build-started-hook . ,default-build-started-hook) @@ -420,55 +419,12 @@ processed?: ~A #:allocation-strategy (assq-ref opts 'allocation-strategy)))) - (perform-coordinator-service-startup - build-coordinator - #:update-datastore? (assoc-ref opts 'update-database) - #:pid-file (assq-ref opts 'pid-file)) - (parameterize ((%show-error-details (assoc-ref opts 'show-error-details))) - ;; Create some worker thread channels, which need to be created prior - ;; to run-fibers being called. - (let ((chunked-request-channel - ;; There are fibers issues when trying to read the chunked - ;; requests, so do this in dedicated threads. - (make-worker-thread-channel (const '()) - #:parallelism 8)) - (substitutes-channel - (make-worker-thread-channel (const '()) - #:parallelism 2))) - - (let ((finished? (make-condition))) - (call-with-sigint - (lambda () - (run-fibers - (lambda () - ;; Start the agent messaging server - (let ((agent-communication-uri - (assq-ref opts 'agent-communication))) - (match (uri-scheme agent-communication-uri) - ('http - (let ((host (uri-host agent-communication-uri)) - (port (uri-port agent-communication-uri))) - (http-agent-messaging-start-server - port - host - (assq-ref opts 'secret-key-base) - build-coordinator - chunked-request-channel) - (simple-format #t "listening on ~A:~A\n" - host port))))) - - ;; Start the client messaging server - (let ((client-communication-uri - (assq-ref opts 'client-communication))) - (start-client-request-server - (assq-ref opts 'secret-key-base) - (uri-host client-communication-uri) - (uri-port client-communication-uri) - build-coordinator - substitutes-channel)) - - (wait finished?)))) - finished?))))))) + (run-coordinator-service + build-coordinator + #: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)))))) |