aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-05-16 10:12:34 +0100
committerChristopher Baines <mail@cbaines.net>2020-05-16 10:15:26 +0100
commitc3d4942323206a5dedd93a9534a82e3589ef5dae (patch)
treee7a9a9203a8f3614dd3d92afa63c109c32532b90 /scripts
parente91a97c44dc824128e45e4a7a80ab9c95fa15c4c (diff)
downloadbuild-coordinator-c3d4942323206a5dedd93a9534a82e3589ef5dae.tar
build-coordinator-c3d4942323206a5dedd93a9534a82e3589ef5dae.tar.gz
Switch the command line options for the agent communication config
To make it clear this is what it's for. This makes it easier to allow other ways of communicating with agent processes in the future, as well as making it easier to set out how to also listen for client commands, which I'm thinking about now.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/guix-build-coordinator.in36
1 files changed, 18 insertions, 18 deletions
diff --git a/scripts/guix-build-coordinator.in b/scripts/guix-build-coordinator.in
index 328d5d5..02ae22d 100644
--- a/scripts/guix-build-coordinator.in
+++ b/scripts/guix-build-coordinator.in
@@ -25,6 +25,7 @@
(use-modules (srfi srfi-1)
(srfi srfi-37)
(ice-9 match)
+ (web uri)
((guix ui) #:select (read/eval))
(guix derivations)
(guix-build-coordinator hooks)
@@ -108,16 +109,11 @@
(alist-cons 'pid-file
arg
result)))
- (option '("port") #t #f
+ (option '("agent-communication") #t #f
(lambda (opt name arg result)
- (alist-cons 'port
- (string->number arg)
- (alist-delete 'port result))))
- (option '("host") #t #f
- (lambda (opt name arg result)
- (alist-cons 'host
+ (alist-cons 'agent-communication
arg
- (alist-delete 'host result))))
+ (alist-delete 'agent-communication result))))
(option '("allocation-strategy") #t #f
(lambda (opt name arg result)
(alist-cons
@@ -152,8 +148,7 @@
(define %service-option-defaults
;; Alist of default option values
- `((port . 8745)
- (host . "0.0.0.0")
+ `((agent-communication . "http://0.0.0.0:8745")
(allocation-strategy . ,basic-build-allocation-strategy)
(build-success-hook . ,default-build-success-hook)
(build-failure-hook . ,default-build-failure-hook)
@@ -379,11 +374,16 @@ processed?: ~A
(parameterize ((%show-error-details
(assoc-ref opts 'show-error-details)))
- (simple-format #t "listening on ~A:~A\n"
- (assq-ref opts 'host)
- (assq-ref opts 'port))
- (http-agent-messaging-start-server
- (assq-ref opts 'port)
- (assq-ref opts 'host)
- (assq-ref opts 'secret-key-base)
- build-coordinator)))))
+ (let ((agent-communication-uri
+ (string->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)))
+ (simple-format #t "listening on ~A:~A\n"
+ host port)
+ (http-agent-messaging-start-server
+ port
+ host
+ (assq-ref opts 'secret-key-base)
+ build-coordinator)))))))))