diff options
author | Christopher Baines <mail@cbaines.net> | 2024-05-12 20:03:50 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2024-05-12 20:03:50 +0100 |
commit | 9066b6d623d4f1b34ee4b9e199590cb4ecb9718a (patch) | |
tree | 40f81cd7244c66068cfea87fcbb81b85883ab9f4 /guix-build-coordinator | |
parent | 2a949442da2f6364805dfbff5f4ca0b9c3069a99 (diff) | |
download | build-coordinator-9066b6d623d4f1b34ee4b9e199590cb4ecb9718a.tar build-coordinator-9066b6d623d4f1b34ee4b9e199590cb4ecb9718a.tar.gz |
Avoid starting new builds when low on disk space
Diffstat (limited to 'guix-build-coordinator')
-rw-r--r-- | guix-build-coordinator/agent.scm | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/guix-build-coordinator/agent.scm b/guix-build-coordinator/agent.scm index 0520da2..a64a61c 100644 --- a/guix-build-coordinator/agent.scm +++ b/guix-build-coordinator/agent.scm @@ -46,7 +46,7 @@ #:use-module (guix base32) #:use-module (guix serialization) #:use-module ((guix build syscalls) - #:select (set-thread-name)) + #:select (set-thread-name free-disk-space)) #:use-module (guix-build-coordinator utils) #:use-module (guix-build-coordinator agent-messaging) #:use-module (guix-build-coordinator agent-messaging abstract) @@ -516,12 +516,21 @@ '()) (lambda () - (fetch-builds-for-agent - coordinator-interface - systems - (+ (max current-threads 1) - (count-post-build-jobs)) - #:log (build-log-procedure lgr))) + (let ((free-space (free-disk-space "/gnu/store"))) + (if (< free-space (* 2 (expt 2 30))) ; 2G + (begin + (log-msg + lgr 'WARN + "low space on /gnu/store, " + "not fetching new builds") + (sleep 30) + '()) + (fetch-builds-for-agent + coordinator-interface + systems + (+ (max current-threads 1) + (count-post-build-jobs)) + #:log (build-log-procedure lgr))))) #:unwind? #t)) (new-builds (remove (lambda (build) |