From c3d4942323206a5dedd93a9534a82e3589ef5dae Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 16 May 2020 10:12:34 +0100 Subject: 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. --- scripts/guix-build-coordinator.in | 36 ++++++++++++++++++------------------ 1 file 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))))))))) -- cgit v1.2.3