aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-10-10 20:56:49 +0100
committerChristopher Baines <mail@cbaines.net>2022-10-10 20:56:49 +0100
commit054658c5496a66d91a8b42f555298c745a7599f6 (patch)
tree6c25995b57972f1ac5f17d22c292b3bdcbdd29d0
parentee089a9e48a569e61134ceff5ccf96b945fed8a7 (diff)
downloadbuild-coordinator-054658c5496a66d91a8b42f555298c745a7599f6.tar
build-coordinator-054658c5496a66d91a8b42f555298c745a7599f6.tar.gz
Allow specifying the maximum number of allocated builds
For an agent.
-rw-r--r--guix-build-coordinator/agent.scm8
-rw-r--r--scripts/guix-build-coordinator-agent.in6
2 files changed, 12 insertions, 2 deletions
diff --git a/guix-build-coordinator/agent.scm b/guix-build-coordinator/agent.scm
index eb3ec3c..b589b65 100644
--- a/guix-build-coordinator/agent.scm
+++ b/guix-build-coordinator/agent.scm
@@ -64,6 +64,7 @@
coordinator-interface
systems
max-parallel-builds
+ max-allocated-builds
max-parallel-uploads
derivation-substitute-urls
non-derivation-substitute-urls
@@ -473,8 +474,11 @@
(while #t
(let ((current-threads (count-threads))
(job-count (count-jobs)))
- (if (or (< job-count current-threads)
- (= job-count 0))
+ (if (and (or (not max-allocated-builds)
+ (< (+ job-count (count-post-build-jobs))
+ max-allocated-builds))
+ (or (< job-count current-threads)
+ (= job-count 0)))
(let* ((queued-build-ids
(append
(map (lambda (job-args)
diff --git a/scripts/guix-build-coordinator-agent.in b/scripts/guix-build-coordinator-agent.in
index 7cfb449..52d77ae 100644
--- a/scripts/guix-build-coordinator-agent.in
+++ b/scripts/guix-build-coordinator-agent.in
@@ -82,6 +82,11 @@
(alist-cons 'max-parallel-builds
(string->number arg)
result)))
+ (option '("max-allocated-builds") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'max-allocated-builds
+ (string->number arg)
+ result)))
(option '("max-1min-load-average") #t #f
(lambda (opt name arg result)
(alist-cons 'max-1min-load-average
@@ -181,6 +186,7 @@
coordinator-interface
(delete-duplicates (assq-ref opts 'systems))
(assq-ref opts 'max-parallel-builds)
+ (assq-ref opts 'max-allocated-builds)
(assq-ref opts 'max-parallel-uploads)
(or (assq-ref opts 'derivation-substitute-urls)
(assq-ref opts 'substitute-urls))