aboutsummaryrefslogtreecommitdiff
path: root/scripts/guix-build-coordinator.in
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-11-12 14:57:56 +0000
committerChristopher Baines <mail@cbaines.net>2021-11-13 10:52:02 +0000
commita6c94ad7481b55403f9dbc034929144a737e9b7d (patch)
tree06e616ea1b9c67297ac61d1e324232f03ac5178a /scripts/guix-build-coordinator.in
parent6e4fb6d7cd7454874d16840cb766ecfdc012e441 (diff)
downloadbuild-coordinator-a6c94ad7481b55403f9dbc034929144a737e9b7d.tar
build-coordinator-a6c94ad7481b55403f9dbc034929144a737e9b7d.tar.gz
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.
Diffstat (limited to 'scripts/guix-build-coordinator.in')
-rw-r--r--scripts/guix-build-coordinator.in26
1 files changed, 26 insertions, 0 deletions
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