diff options
author | Christopher Baines <mail@cbaines.net> | 2020-09-16 20:46:54 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-09-16 21:19:56 +0100 |
commit | 4f17609b377c128888be6d85af46fb05fe38ce45 (patch) | |
tree | 3de81e7b2198abe0e87adc387c91adbb6a523baf | |
parent | 3530d332bd1a34f508cb25ba684622219cdc388f (diff) | |
download | build-coordinator-4f17609b377c128888be6d85af46fb05fe38ce45.tar build-coordinator-4f17609b377c128888be6d85af46fb05fe38ce45.tar.gz |
Move more coordinator service startup out of the script
-rw-r--r-- | guix-build-coordinator/coordinator.scm | 20 | ||||
-rw-r--r-- | scripts/guix-build-coordinator.in | 15 |
2 files changed, 24 insertions, 11 deletions
diff --git a/guix-build-coordinator/coordinator.scm b/guix-build-coordinator/coordinator.scm index c8727c8..a38045b 100644 --- a/guix-build-coordinator/coordinator.scm +++ b/guix-build-coordinator/coordinator.scm @@ -42,6 +42,8 @@ build-coordinator-metrics-registry build-coordinator-allocation-strategy + perform-coordinator-service-startup + submit-build new-agent new-agent-password @@ -82,8 +84,26 @@ build-coordinator (make-build-allocator-thread build-coordinator)) + (start-hook-processing-threads build-coordinator) + build-coordinator)) +(define* (perform-coordinator-service-startup build-coordinator + #:key + (update-datastore? #t) + (pid-file #f) + (trigger-build-allocation? #t)) + (when update-datastore? + (datastore-update (build-coordinator-datastore build-coordinator))) + + (when pid-file + (call-with-output-file pid-file + (lambda (port) + (simple-format port "~A\n" (getpid))))) + + (when trigger-build-allocation? + (trigger-build-allocation build-coordinator))) + (define* (submit-build build-coordinator derivation-file #:key requested-uuid diff --git a/scripts/guix-build-coordinator.in b/scripts/guix-build-coordinator.in index 8aed241..59341cc 100644 --- a/scripts/guix-build-coordinator.in +++ b/scripts/guix-build-coordinator.in @@ -420,14 +420,10 @@ processed?: ~A #:allocation-strategy (assq-ref opts 'allocation-strategy)))) - (when (assoc-ref opts 'update-database) - (datastore-update datastore)) - - (let ((pid-file (assq-ref opts 'pid-file))) - (when pid-file - (call-with-output-file pid-file - (lambda (port) - (simple-format port "~A\n" (getpid)))))) + (perform-coordinator-service-startup + build-coordinator + #:update-datastore? (assoc-ref opts 'update-database) + #:pid-file (assq-ref opts 'pid-file)) (parameterize ((%show-error-details (assoc-ref opts 'show-error-details))) @@ -443,9 +439,6 @@ processed?: ~A (make-worker-thread-channel (const '()) #:parallelism 2))) - (start-hook-processing-threads build-coordinator) - (trigger-build-allocation build-coordinator) - (let ((finished? (make-condition))) (call-with-sigint (lambda () |