From a6c94ad7481b55403f9dbc034929144a737e9b7d Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 12 Nov 2021 14:57:56 +0000 Subject: Support activating and deactivating agents Not sure these are the best terms to use, but I want a way to pause agents, effectively removing them from the build allocation plan. This is mostly motivated by the lack of disk space on bayfront, as deactivating agents provides a way to stop the system from filling up with builds, but I think there's more general uses as well. --- scripts/guix-build-coordinator.in | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'scripts/guix-build-coordinator.in') diff --git a/scripts/guix-build-coordinator.in b/scripts/guix-build-coordinator.in index b3b20f4..1fbcad3 100644 --- a/scripts/guix-build-coordinator.in +++ b/scripts/guix-build-coordinator.in @@ -656,6 +656,32 @@ tags: #:description (assq-ref opts 'description)))) (simple-format #t "agent created as as ~A\n" (assoc-ref response "agent-id"))))) + (("agent" agent-id "activate" rest ...) + (let ((opts (parse-options %base-options + (append %client-option-defaults + %base-option-defaults) + rest))) + (let ((response (send-agent-set-active-request + (assq-ref opts 'coordinator) + agent-id + #true))) + (if (string=? (assoc-ref response "result") + "success") + (display "successfully activated agent\n") + (display "error activating agent\n"))))) + (("agent" agent-id "deactivate" rest ...) + (let ((opts (parse-options %base-options + (append %client-option-defaults + %base-option-defaults) + rest))) + (let ((response (send-agent-set-active-request + (assq-ref opts 'coordinator) + agent-id + #false))) + (if (string=? (assoc-ref response "result") + "success") + (display "successfully deactivated agent\n") + (display "error activating agent\n"))))) (("agent" agent-id "password" "new" rest ...) (let ((opts (parse-options %base-options (append %client-option-defaults -- cgit v1.2.3