aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/jobs.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-07-14 14:16:05 +0100
committerChristopher Baines <mail@cbaines.net>2019-07-14 14:43:47 +0100
commit6904547bf2dc9dae516af3911b1dd967ae7d47a6 (patch)
tree2d3b5cffb5e23652e7c70e0b945e97fa1a0825af /guix-data-service/jobs.scm
parent3dfa9212f1a492103e3c639ab16e7ccfdddc9134 (diff)
downloaddata-service-6904547bf2dc9dae516af3911b1dd967ae7d47a6.tar
data-service-6904547bf2dc9dae516af3911b1dd967ae7d47a6.tar.gz
Record jobs as failed when they are killed
So that they aren't retried again and again.
Diffstat (limited to 'guix-data-service/jobs.scm')
-rw-r--r--guix-data-service/jobs.scm18
1 files changed, 16 insertions, 2 deletions
diff --git a/guix-data-service/jobs.scm b/guix-data-service/jobs.scm
index a63821f..dd680d0 100644
--- a/guix-data-service/jobs.scm
+++ b/guix-data-service/jobs.scm
@@ -13,8 +13,17 @@
"guix-data-service-process-job"
job-id))
+ (define (handle-job-failure job-id)
+ (record-job-event conn job-id "failure")
+ (display (simple-format #f "recording failure for job ~A\n" job-id)
+ (current-error-port))
+ (when (> (count-log-parts conn job-id)
+ 0)
+ (combine-log-parts! conn job-id)))
+
(process-jobs-concurrently fetch-new-jobs
- process-job))
+ process-job
+ handle-job-failure))
(define default-max-processes
(max (round (/ (current-processor-count)
@@ -27,6 +36,7 @@
(define* (process-jobs-concurrently fetch-new-jobs
process-job
+ handle-job-failure
#:key (max-processes
default-max-processes)
(timeout default-timeout))
@@ -88,7 +98,11 @@
#f "sending SIGTERM to pid ~A started at ~A, now running for ~A\n"
pid start-time running-for)
(current-error-port))
- (kill pid SIGTERM)))))
+ (kill pid SIGTERM)
+
+ (match job-args
+ ((id)
+ (handle-job-failure id)))))))
processes))
(define (fork-and-process-job job-args)