aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/agent.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-04-20 15:33:31 +0100
committerChristopher Baines <mail@cbaines.net>2023-04-20 15:33:31 +0100
commite36dd9ecd5d4e1c1b474a27a056b09f58d84ba1f (patch)
treee4185303a129f82ca052508d427be54746ad2e9b /guix-build-coordinator/agent.scm
parentfd496f430afa91bb1f488dea702ff8f2446b965c (diff)
downloadbuild-coordinator-e36dd9ecd5d4e1c1b474a27a056b09f58d84ba1f.tar
build-coordinator-e36dd9ecd5d4e1c1b474a27a056b09f58d84ba1f.tar.gz
More reliably delete the compressed outputs
Diffstat (limited to 'guix-build-coordinator/agent.scm')
-rw-r--r--guix-build-coordinator/agent.scm28
1 files changed, 21 insertions, 7 deletions
diff --git a/guix-build-coordinator/agent.scm b/guix-build-coordinator/agent.scm
index f5ae50a..fc0ed3f 100644
--- a/guix-build-coordinator/agent.scm
+++ b/guix-build-coordinator/agent.scm
@@ -960,6 +960,22 @@ but the guix-daemon claims it's unavailable"
(define outputs
(derivation-outputs derivation))
+ (define (maybe-delete-compressed-outputs)
+ (with-exception-handler
+ (lambda (exn)
+ (log-msg lgr 'ERROR
+ build-id ": exception deleting compressed outputs: "
+ exn))
+ (lambda ()
+ (when submit-outputs?
+ (for-each
+ (lambda (file)
+ (log-msg lgr 'INFO
+ build-id ": deleting " file)
+ (delete-file file))
+ (map cdr compressed-outputs))))
+ #:unwind? #t))
+
(define (attempt-submit-build-result)
(with-exception-handler
(lambda (exn)
@@ -973,10 +989,12 @@ but the guix-daemon claims it's unavailable"
((string=? details "build_already_processed")
(log-msg lgr 'WARN
build-id ": coordinator indicates this build is already marked as processed")
+ (maybe-delete-compressed-outputs)
#t)
((string=? details "cannot_store_result_for_canceled_build")
(log-msg lgr 'WARN
build-id ": coordinator indicates this build is now canceled")
+ (maybe-delete-compressed-outputs)
#t)
((string=? details "missing_build_log_file")
;; Retry submitting the log file
@@ -987,6 +1005,8 @@ but the guix-daemon claims it's unavailable"
(attempt-submit-build-result))
(else
+ (maybe-delete-compressed-outputs)
+
(raise-exception
(make-exception
(make-exception-with-message
@@ -1044,13 +1064,7 @@ but the guix-daemon claims it's unavailable"
(outputs . ,(list->vector output-details)))
#:log (build-log-procedure lgr build-id))
- (when submit-outputs?
- (for-each
- (lambda (file)
- (log-msg lgr 'INFO
- build-id ": deleting " file)
- (delete-file file))
- (map cdr compressed-outputs))))
+ (maybe-delete-compressed-outputs))
#:unwind? #t))
(define (submit-one-output output-name output bytes compressed-file)