diff options
author | Christopher Baines <mail@cbaines.net> | 2020-11-29 09:59:16 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-11-29 09:59:16 +0000 |
commit | ed3b2e56655ccf4cd9574f00e72b20e9022d9ab0 (patch) | |
tree | 4d82f6d340acefd07117061aa52dc8dbf1f769d9 /guix-build-coordinator/agent.scm | |
parent | 4e68e6564ce1335aa084ffb334697feaa7ce7fc1 (diff) | |
download | build-coordinator-ed3b2e56655ccf4cd9574f00e72b20e9022d9ab0.tar build-coordinator-ed3b2e56655ccf4cd9574f00e72b20e9022d9ab0.tar.gz |
Fix the post-build-failure procedure to handle agent errors
Spot when the coordinator says the build is already processed, and don't raise
an exception.
Diffstat (limited to 'guix-build-coordinator/agent.scm')
-rw-r--r-- | guix-build-coordinator/agent.scm | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/guix-build-coordinator/agent.scm b/guix-build-coordinator/agent.scm index 9ba0aae..33fb4f6 100644 --- a/guix-build-coordinator/agent.scm +++ b/guix-build-coordinator/agent.scm @@ -318,10 +318,38 @@ build-id derivation end-time) (simple-format #t "build ~A failed, reporting to coordinator\n" build-id) - (submit-build-result coordinator-uri uuid password - build-id - `((result . failure) - (end_time . ,(strftime "%F %T" end-time))))) + (with-exception-handler + (lambda (exn) + (unless (agent-error-from-coordinator? exn) + (raise-exception exn)) + + (let ((details + (agent-error-from-coordinator-details exn))) + (if (string? details) + (cond + ((string=? details "build_already_processed") + (simple-format + #t "warning: coordinator indicates this build is already marked as processed\n") + #t) + (else + (raise-exception + (make-exception + (make-exception-with-message + "unrecognised error from coordinator") + (make-exception-with-irritants + details))))) + (raise-exception + (make-exception + (make-exception-with-message + "unrecognised error from coordinator") + (make-exception-with-irritants + details)))))) + (lambda () + (submit-build-result coordinator-uri uuid password + build-id + `((result . failure) + (end_time . ,(strftime "%F %T" end-time))))) + #:unwind? #t)) (define (post-build-success uuid coordinator-uri password build-id derivation end-time) |