diff options
Diffstat (limited to 'guix-build-coordinator/agent.scm')
-rw-r--r-- | guix-build-coordinator/agent.scm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/guix-build-coordinator/agent.scm b/guix-build-coordinator/agent.scm index 9ace7d3..f80cb10 100644 --- a/guix-build-coordinator/agent.scm +++ b/guix-build-coordinator/agent.scm @@ -45,7 +45,8 @@ max-parallel-builds derivation-substitute-urls non-derivation-substitute-urls - metrics-file) + metrics-file + max-5min-load-average) (define lgr (make <logger>)) (define port-log (make <port-log> #:port (current-output-port) @@ -90,6 +91,15 @@ (write-textfile metrics-registry metrics-file))) + (define (wait-for-low-load build-id) + (let ((current-load (get-load-average))) + (when (>= current-load max-5min-load-average) + (log-msg lgr 'INFO + build-id + ": holding build start due to high load") + (sleep 30) + (wait-for-low-load build-id)))) + (define (process-job build) (let ((build-id (assoc-ref build "uuid")) (derivation-name (assoc-ref build "derivation-name"))) @@ -113,6 +123,7 @@ (write-metrics) (if (eq? (assq-ref pre-build-status 'result) 'success) (begin + (wait-for-low-load build-id) (log-msg lgr 'INFO build-id ": setup successful, building: " |