[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/05: offload: Recognize build failures due to lack of disk space.
From: |
guix-commits |
Subject: |
04/05: offload: Recognize build failures due to lack of disk space. |
Date: |
Fri, 21 Dec 2018 17:50:21 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit b96e05aefd7a4f734cfec3b27c2d38320d43b687
Author: Ludovic Courtès <address@hidden>
Date: Fri Dec 21 23:31:19 2018 +0100
offload: Recognize build failures due to lack of disk space.
Previously, if a remote build would fail due to lack of disk space, this
would be considered a permanent failure and thus cached as a build
failure if the local daemon runs with '--cache-failures'.
* guix/scripts/offload.scm (transfer-and-offload): Upon
'nix-protocol-error?' call 'node-free-disk-space' and return 1 instead
of 100 if the result if lower than 10 MiB.
---
guix/scripts/offload.scm | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/guix/scripts/offload.scm b/guix/scripts/offload.scm
index 0bedcb4..1e0ea1c 100644
--- a/guix/scripts/offload.scm
+++ b/guix/scripts/offload.scm
@@ -367,9 +367,19 @@ MACHINE."
(derivation-file-name drv)
(build-machine-name machine)
(nix-protocol-error-message c))
- ;; Use exit code 100 for a permanent build failure. The daemon
- ;; interprets other non-zero codes as transient build failures.
- (primitive-exit 100)))
+ (let* ((space (false-if-exception
+ (node-free-disk-space (make-node session)))))
+
+ ;; Use exit code 100 for a permanent build failure. The daemon
+ ;; interprets other non-zero codes as transient build failures.
+ (if (and space (< space (* 10 (expt 2 20))))
+ (begin
+ (format (current-error-port)
+ (G_ "build failure may have been caused by lack \
+of free disk space on '~a'~%")
+ (build-machine-name machine))
+ (primitive-exit 1))
+ (primitive-exit 100)))))
(parameterize ((current-build-output-port (build-log-port)))
(build-derivations store (list drv))))