diff options
author | Christopher Baines <mail@cbaines.net> | 2025-01-14 10:31:58 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2025-01-14 10:31:58 +0000 |
commit | fd006da5558a53a868132af00ec4b57694c99930 (patch) | |
tree | f7b7a14e3f3e0b01e4e6bea3c4829458c60e2bfe | |
parent | a781bd1ba8e65cca2baa28a3cb80f55bccc648d3 (diff) | |
download | build-coordinator-fd006da5558a53a868132af00ec4b57694c99930.tar build-coordinator-fd006da5558a53a868132af00ec4b57694c99930.tar.gz |
Update Guile Knots
-rw-r--r-- | guix-build-coordinator/agent-messaging/http/server.scm | 6 | ||||
-rw-r--r-- | guix-build-coordinator/client-communication.scm | 8 | ||||
-rw-r--r-- | guix-build-coordinator/coordinator.scm | 9 | ||||
-rw-r--r-- | guix-build-coordinator/datastore.scm | 6 | ||||
-rw-r--r-- | guix-build-coordinator/datastore/sqlite.scm | 259 | ||||
-rw-r--r-- | guix-dev.scm | 4 |
6 files changed, 146 insertions, 146 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm index 1333a10..6c108cf 100644 --- a/guix-build-coordinator/agent-messaging/http/server.scm +++ b/guix-build-coordinator/agent-messaging/http/server.scm @@ -48,7 +48,7 @@ #:use-module (fibers operations) #:use-module (knots timeout) #:use-module (knots web-server) - #:use-module (knots worker-threads) + #:use-module (knots thread-pool) #:use-module (prometheus) #:use-module (guix base32) #:use-module (guix base64) @@ -1012,7 +1012,7 @@ INTERVAL (a time-duration object), otherwise does nothing and returns #f." (render-json `((error . chunked-input-ended-prematurely)) #:code 400)) - ((worker-thread-timeout-error? exn) + ((thread-pool-timeout-error? exn) (render-json `((error . ,(simple-format #f "~A" exn))) #:code 503)) @@ -1026,7 +1026,7 @@ INTERVAL (a time-duration object), otherwise does nothing and returns #f." (lambda (key . args) (unless (and (eq? '%exception key) (or (agent-error? (car args)) - (worker-thread-timeout-error? (car args)) + (thread-pool-timeout-error? (car args)) (chunked-input-ended-prematurely-error? (car args)))) (match method-and-path-components ((method path-components ...) diff --git a/guix-build-coordinator/client-communication.scm b/guix-build-coordinator/client-communication.scm index 1c7d67f..b7a950c 100644 --- a/guix-build-coordinator/client-communication.scm +++ b/guix-build-coordinator/client-communication.scm @@ -33,7 +33,7 @@ #:use-module (logging logger) #:use-module (gcrypt random) #:use-module (knots web-server) - #:use-module (knots worker-threads) + #:use-module (knots thread-pool) #:use-module (prometheus) #:use-module (web uri) #:use-module (web client) @@ -498,7 +498,7 @@ derivation-file #:substitute-urls substitute-urls))) ;; Read the derivation in a thread to avoid blocking fibers - (call-with-worker-thread + (call-with-thread utility-thread-pool (lambda () (read-derivation-from-file* derivation-file)))) @@ -669,7 +669,7 @@ (render-json `((error . ,(client-error-details exn))) #:code 400)) - ((worker-thread-timeout-error? exn) + ((thread-pool-timeout-error? exn) (render-json `((error . ,(simple-format #f "~A" exn))) #:code 503)) @@ -683,7 +683,7 @@ (lambda (key . args) (unless (and (eq? '%exception key) (or - (worker-thread-timeout-error? (car args)) + (thread-pool-timeout-error? (car args)) (client-error? (car args)))) (match method-and-path-components ((method path-components ...) diff --git a/guix-build-coordinator/coordinator.scm b/guix-build-coordinator/coordinator.scm index 4b22318..71dffb7 100644 --- a/guix-build-coordinator/coordinator.scm +++ b/guix-build-coordinator/coordinator.scm @@ -50,7 +50,7 @@ #:use-module (fibers conditions) #:use-module (knots) #:use-module (knots timeout) - #:use-module (knots worker-threads) + #:use-module (knots thread-pool) #:use-module (prometheus) #:use-module (guix store) #:use-module (guix derivations) @@ -367,7 +367,7 @@ (database-uri->datastore database-uri-string #:metrics-registry metrics-registry - #:worker-thread-log-exception? + #:thread-pool-log-exception? (lambda (exn) (and (not (agent-error? exn)) (not (client-error? exn)))))) @@ -503,10 +503,9 @@ build-coordinator)) (utility-thread-pool - (make-worker-thread-set - (const '()) + (make-thread-pool + 10 #:name "utility" - #:parallelism 10 #:delay-logger (let ((delay-metric (make-histogram-metric diff --git a/guix-build-coordinator/datastore.scm b/guix-build-coordinator/datastore.scm index dc4fec6..3aaf2a7 100644 --- a/guix-build-coordinator/datastore.scm +++ b/guix-build-coordinator/datastore.scm @@ -96,15 +96,15 @@ (define* (database-uri->datastore database #:key metrics-registry - worker-thread-log-exception?) + thread-pool-log-exception?) (cond ((string-prefix? "pg://" database) (postgresql-datastore database)) ((string-prefix? "sqlite://" database) (sqlite-datastore database #:metrics-registry metrics-registry - #:worker-thread-log-exception? - worker-thread-log-exception?)) + #:thread-pool-log-exception? + thread-pool-log-exception?)) (else (error (simple-format #f "Unknown database ~A" database))))) diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm index d372cf0..9a1d0d6 100644 --- a/guix-build-coordinator/datastore/sqlite.scm +++ b/guix-build-coordinator/datastore/sqlite.scm @@ -11,7 +11,7 @@ #:use-module (sqlite3) #:use-module (fibers) #:use-module (knots parallelism) - #:use-module (knots worker-threads) + #:use-module (knots thread-pool) #:use-module (prometheus) #:use-module (guix base16) #:use-module (guix derivations) @@ -108,17 +108,17 @@ (define-class <sqlite-datastore> (<abstract-datastore>) database-file - worker-reader-thread-set - worker-writer-thread-set - worker-low-priority-writer-thread-channel - worker-high-priority-writer-thread-channel + reader-thread-pool + writer-thread-pool + low-priority-writer-thread-channel + high-priority-writer-thread-channel metrics-registry) (define* (sqlite-datastore database-uri #:key update-database? metrics-registry - worker-thread-log-exception?) + thread-pool-log-exception?) (define database-file (string-drop database-uri (string-length "sqlite://"))) @@ -141,8 +141,11 @@ (slot-set! datastore 'database-file database-file) (slot-set! datastore 'metrics-registry metrics-registry) - (let ((worker-thread-set - (make-worker-thread-set + (let ((writer-thread-pool + (make-thread-pool + ;; SQLite doesn't support parallel writes + 1 + #:thread-initializer (lambda () (let ((db (db-open database-file))) @@ -153,7 +156,7 @@ (list db))) #:name "ds write" - #:destructor + #:thread-destructor (let ((writer-thread-destructor-counter (make-gauge-metric metrics-registry "datastore_writer_thread_close_total"))) @@ -165,11 +168,9 @@ (metric-increment writer-thread-destructor-counter) (sqlite-close db))) - #:lifetime 500 + #:thread-lifetime 500 #:expire-on-exception? #t - ;; SQLite doesn't support parallel writes - #:parallelism 1 #:delay-logger (let ((delay-metric (make-histogram-metric metrics-registry @@ -195,21 +196,26 @@ "warning: database write took ~1,2f seconds (~a)~%" duration proc))) - #:log-exception? worker-thread-log-exception?))) + #:log-exception? thread-pool-log-exception?))) (slot-set! datastore - 'worker-writer-thread-set - worker-thread-set) + 'writer-thread-pool + writer-thread-pool) ;; This is changed in datastore-spawn-fibers (slot-set! datastore - 'worker-low-priority-writer-thread-channel - (worker-thread-set-channel worker-thread-set)) + 'low-priority-writer-thread-channel + (thread-pool-channel writer-thread-pool)) (slot-set! datastore - 'worker-high-priority-writer-thread-channel - (worker-thread-set-channel worker-thread-set))) + 'high-priority-writer-thread-channel + (thread-pool-channel writer-thread-pool))) - (let ((worker-thread-set - (make-worker-thread-set + (let ((reader-thread-pool + (make-thread-pool + ;; Use a minimum of 8 and a maximum of 16 threads + (min (max (current-processor-count) + 8) + 16) + #:thread-initializer (lambda () (let ((db (db-open database-file #:write? #f))) @@ -218,22 +224,17 @@ (sqlite-exec db "PRAGMA cache_size = -16000;") (list db))) - #:name "ds read" - #:destructor + #:thread-destructor (let ((reader-thread-destructor-counter (make-gauge-metric metrics-registry "datastore_reader_thread_close_total"))) (lambda (db) (metric-increment reader-thread-destructor-counter) (sqlite-close db))) - #:lifetime 50000 + #:name "ds read" + #:thread-lifetime 50000 #:expire-on-exception? #t - ;; Use a minimum of 8 and a maximum of 16 threads - #:parallelism - (min (max (current-processor-count) - 8) - 16) #:delay-logger (let ((delay-metric (make-histogram-metric metrics-registry @@ -259,26 +260,26 @@ "warning: database read took ~1,2f seconds (~a)~%" duration proc))) - #:log-exception? worker-thread-log-exception?))) + #:log-exception? thread-pool-log-exception?))) (slot-set! datastore - 'worker-reader-thread-set - worker-thread-set)) + 'reader-thread-pool + reader-thread-pool)) datastore)) -(define* (call-with-writer-worker-thread +(define* (call-with-writer-thread datastore proc #:key priority? duration-logger) - (call-with-worker-thread - (slot-ref datastore 'worker-writer-thread-set) + (call-with-thread + (slot-ref datastore 'writer-thread-pool) proc #:duration-logger duration-logger #:channel (slot-ref datastore (if priority? - 'worker-high-priority-writer-thread-channel - 'worker-low-priority-writer-thread-channel)))) + 'high-priority-writer-thread-channel + 'low-priority-writer-thread-channel)))) (define (sqlite-step-and-reset statement) (let ((val (sqlite-step statement))) @@ -346,7 +347,7 @@ PRAGMA optimize;") (define-method (datastore-optimize (datastore <sqlite-datastore>)) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-writer-thread-channel) (lambda (db) (db-optimize @@ -373,8 +374,8 @@ PRAGMA optimize;") (simple-format (current-error-port) "reader thread ~A running: ~A\n" i proc)) - (worker-thread-set-thread-proc-vector - (slot-ref datastore 'worker-reader-thread-set)))))) + (thread-pool-proc-vector + (slot-ref datastore 'reader-thread-pool)))))) (spawn-fiber (lambda () @@ -506,21 +507,21 @@ PRAGMA optimize;") metric-name)))) (metric-observe metric duration-seconds))) -(define (call-with-worker-thread/delay-logging worker-thread-set proc) - (call-with-worker-thread worker-thread-set +(define (call-with-thread/delay-logging thread-pool proc) + (call-with-thread thread-pool + proc + #:duration-logger + (lambda (duration) + (log-delay proc duration)))) + +(define* (call-with-writer-thread/delay-logging datastore proc + #:key priority?) + (call-with-writer-thread datastore proc #:duration-logger (lambda (duration) - (log-delay proc duration)))) - -(define* (call-with-writer-worker-thread/delay-logging datastore proc - #:key priority?) - (call-with-writer-worker-thread datastore - proc - #:duration-logger - (lambda (duration) - (log-delay proc duration)) - #:priority? priority?)) + (log-delay proc duration)) + #:priority? priority?)) (define-exception-type &transaction-rollback-exception &exception make-transaction-rollback-exception @@ -604,7 +605,7 @@ PRAGMA optimize;") ;; Database is busy, so retry (run-proc-within-transaction db))) - (call-with-worker-thread + (call-with-thread (slot-ref datastore (if readonly? 'worker-reader-thread-set 'worker-writer-thread-set)) @@ -614,9 +615,9 @@ PRAGMA optimize;") (run-proc-within-transaction db))) #:channel (if readonly? - (worker-thread-set-channel - (slot-ref datastore 'worker-reader-thread-set)) - (slot-ref datastore 'worker-low-priority-writer-thread-channel)) + (thread-pool-channel + (slot-ref datastore 'reader-thread-pool)) + (slot-ref datastore 'low-priority-writer-thread-channel)) #:duration-logger (lambda (duration-seconds) (when (and (not readonly?) @@ -637,7 +638,7 @@ PRAGMA optimize;") (define-method (datastore-find-agent (datastore <sqlite-datastore>) uuid) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -666,7 +667,7 @@ SELECT description FROM agents WHERE id = :id" (define-method (datastore-find-agent-by-name (datastore <sqlite-datastore>) name) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -694,7 +695,7 @@ SELECT id FROM agents WHERE name = :name" (define-method (datastore-insert-dynamic-auth-token (datastore <sqlite-datastore>) token) - (call-with-writer-worker-thread + (call-with-writer-thread datastore (lambda (db) (let ((statement @@ -713,7 +714,7 @@ INSERT INTO dynamic_auth_tokens (token) VALUES (:token)" (define-method (datastore-dynamic-auth-token-exists? (datastore <sqlite-datastore>) token) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -741,7 +742,7 @@ SELECT 1 FROM dynamic_auth_tokens WHERE token = :token" (define-method (datastore-fetch-agent-tags (datastore <sqlite-datastore>) agent-id) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -778,7 +779,7 @@ WHERE agent_tags.agent_id = :agent_id" uuid name description) - (call-with-writer-worker-thread + (call-with-writer-thread datastore (lambda (db) (insert-agent db uuid name description))) @@ -786,7 +787,7 @@ WHERE agent_tags.agent_id = :agent_id" (define-method (datastore-list-agents (datastore <sqlite-datastore>)) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -815,7 +816,7 @@ SELECT id, name, description, active FROM agents ORDER BY id" (unless (boolean? active?) (error "datastore-set-agent-active called with non-boolean")) - (call-with-writer-worker-thread + (call-with-writer-thread datastore (lambda (db) (let ((statement @@ -835,7 +836,7 @@ UPDATE agents SET active = :active WHERE id = :uuid" (define-method (datastore-find-agent-status (datastore <sqlite-datastore>) agent-id) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -870,7 +871,7 @@ WHERE agent_id = :agent_id" 1min-load-average system-uptime processor-count) - (call-with-writer-worker-thread + (call-with-writer-thread datastore (lambda (db) (let ((statement @@ -907,7 +908,7 @@ INSERT INTO agent_status (agent_id, status, load_average_1min, system_uptime, pr (datastore <sqlite-datastore>) agent-uuid password) - (call-with-writer-worker-thread + (call-with-writer-thread datastore (lambda (db) (insert-agent-password db agent-uuid password))) @@ -917,7 +918,7 @@ INSERT INTO agent_status (agent_id, status, load_average_1min, system_uptime, pr (datastore <sqlite-datastore>) uuid password) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -940,7 +941,7 @@ WHERE agent_id = :agent_id AND password = :password" (define-method (datastore-agent-list-passwords (datastore <sqlite-datastore>) uuid) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -1045,7 +1046,7 @@ INSERT INTO agent_tags (agent_id, tag_id) VALUES (:agent_id, :tag_id)" (define-method (datastore-build-exists-for-derivation-outputs? (datastore <sqlite-datastore>) derivation) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -1078,7 +1079,7 @@ WHERE derivation_outputs.derivation_id = :derivation_id (define-method (datastore-build-required-by-another? (datastore <sqlite-datastore>) uuid) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -1173,7 +1174,7 @@ SELECT name FROM derivations WHERE id = :id" (match (sqlite-step-and-reset statement) (#(name) name)))) - (call-with-worker-thread/delay-logging + (call-with-thread/delay-logging (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let loop ((derivation-ids (list (db-find-derivation-id db derivation))) @@ -1199,7 +1200,7 @@ SELECT name FROM derivations WHERE id = :id" args) (apply (lambda* (system #:key include-cancelled?) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -1288,7 +1289,7 @@ FROM ( (define-method (datastore-list-builds-for-derivation-recursive-inputs (datastore <sqlite-datastore>) derivation) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -1326,7 +1327,7 @@ INNER JOIN related_derivations (define-method (datastore-find-unprocessed-build-entry (datastore <sqlite-datastore>) uuid) - (call-with-worker-thread/delay-logging + (call-with-thread/delay-logging (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -1356,7 +1357,7 @@ WHERE build_id = :build_id" (datastore <sqlite-datastore>) build-uuid tags) - (call-with-writer-worker-thread + (call-with-writer-thread datastore (lambda (db) (let ((insert-tag-statement @@ -1557,7 +1558,7 @@ WHERE build_id = :build_id" uuid explicit-priority-lower-bound) (define builds-to-consider - (call-with-worker-thread/delay-logging + (call-with-thread/delay-logging (slot-ref datastore 'worker-reader-thread-set) (lambda (db) ;; Recursively find builds for all missing outputs that this build @@ -1708,7 +1709,7 @@ WHERE build_id = :build_id" override-derived-priority) (let ((build-id old-priority - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((build-id @@ -1768,7 +1769,7 @@ WHERE build_id = :build_id" (define-method (datastore-count-build-results (datastore <sqlite-datastore>)) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -1827,7 +1828,7 @@ VALUES (:agent_id, :result, 1)" #t)))) - (call-with-writer-worker-thread/delay-logging + (call-with-writer-thread/delay-logging datastore (lambda (db) (let ((statement @@ -1879,7 +1880,7 @@ LIMIT 1" (#f #t) (#(1) #f)))) - (call-with-writer-worker-thread/delay-logging + (call-with-writer-thread/delay-logging datastore (lambda (db) (let ((builds-statement @@ -1931,7 +1932,7 @@ WHERE build_id = :build_id" (define-method (datastore-remove-build-allocation (datastore <sqlite-datastore>) build-uuid agent-id) - (call-with-writer-worker-thread/delay-logging + (call-with-writer-thread/delay-logging datastore (lambda (db) (let ((statement @@ -1954,7 +1955,7 @@ DELETE FROM allocated_builds (define-method (datastore-mark-build-as-processed (datastore <sqlite-datastore>) build-uuid end-time) - (call-with-writer-worker-thread/delay-logging + (call-with-writer-thread/delay-logging datastore (lambda (db) (let ((statement @@ -1991,7 +1992,7 @@ DELETE FROM unprocessed_builds_with_derived_priorities (define-method (datastore-delete-relevant-outputs-from-unbuilt-outputs (datastore <sqlite-datastore>) build-uuid) - (call-with-writer-worker-thread/delay-logging + (call-with-writer-thread/delay-logging datastore (lambda (db) (let ((statement @@ -2019,7 +2020,7 @@ WHERE output_id IN ( (datastore <sqlite-datastore>) build-uuid output-metadata) - (call-with-writer-worker-thread/delay-logging + (call-with-writer-thread/delay-logging datastore (lambda (db) (define (name->output-id name) @@ -2097,7 +2098,7 @@ INSERT INTO build_starts ( (define-method (datastore-find-build-starts (datastore <sqlite-datastore>) build-uuid) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2207,7 +2208,7 @@ INSERT INTO setup_failure_missing_inputs ( (define-method (datastore-list-setup-failure-missing-inputs (datastore <sqlite-datastore>) setup-failure-id) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2236,7 +2237,7 @@ WHERE setup_failure_id = :id" build-uuid agent-id failure-reason) - (call-with-writer-worker-thread + (call-with-writer-thread datastore (lambda (db) (insert-setup-failure-and-remove-allocation db @@ -2254,7 +2255,7 @@ WHERE setup_failure_id = :id" (define-method (datastore-count-builds (datastore <sqlite-datastore>)) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2278,7 +2279,7 @@ FROM builds_counts" (define-method (datastore-for-each-build (datastore <sqlite-datastore>) proc) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2318,7 +2319,7 @@ SELECT id FROM builds WHERE uuid = :uuid" (define-method (datastore-find-build (datastore <sqlite-datastore>) uuid) - (call-with-worker-thread/delay-logging + (call-with-thread/delay-logging (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2381,7 +2382,7 @@ WHERE uuid = :uuid" (limit #f) ;; other-builds-dependent or no-dependent-builds (relationship 'unset)) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (define tag->expression @@ -2612,7 +2613,7 @@ WHERE derivation_outputs.derivation_id = builds.derivation_id)")) (define-method (datastore-fetch-build-tags (datastore <sqlite-datastore>) build-uuid) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2647,7 +2648,7 @@ WHERE build_tags.build_id = :build_id" (define-method (datastore-find-build-result (datastore <sqlite-datastore>) build-uuid) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2673,7 +2674,7 @@ WHERE build_id = :build_id" (define-method (datastore-find-build-derivation-system (datastore <sqlite-datastore>) build-uuid) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2710,7 +2711,7 @@ WHERE builds.id = :build_id" datastore "list_builds_for_output" (lambda () - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2759,7 +2760,7 @@ WHERE derivation_outputs.output_id = :output_id" rest) (apply (lambda* (output system #:key include-canceled?) - (call-with-worker-thread/delay-logging + (call-with-thread/delay-logging (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2804,7 +2805,7 @@ WHERE derivation_outputs.output_id = :output_id rest) (apply (lambda* (derivation #:key (include-canceled? #t)) - (call-with-worker-thread/delay-logging + (call-with-thread/delay-logging (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2840,7 +2841,7 @@ WHERE derivations.name = :derivation" (define-method (datastore-count-setup-failures (datastore <sqlite-datastore>)) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2865,7 +2866,7 @@ GROUP BY agent_id, failure_reason" (define-method (datastore-list-setup-failures-for-build (datastore <sqlite-datastore>) build-uuid) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2898,7 +2899,7 @@ WHERE build_id = :build_id" args) (apply (lambda* (#:key agent-id) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2950,7 +2951,7 @@ WHERE builds.processed = 0 (define-method (datastore-list-processed-builds (datastore <sqlite-datastore>)) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -2977,7 +2978,7 @@ WHERE processed = 1" (define-method (datastore-list-unprocessed-builds (datastore <sqlite-datastore>)) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3015,7 +3016,7 @@ ORDER BY priority DESC" (define-method (datastore-find-deferred-build (datastore <sqlite-datastore>) select?) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3082,7 +3083,7 @@ WHERE all_inputs_built = 1 result))) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) fetch-prioritised-unprocessed-builds)) @@ -3090,7 +3091,7 @@ WHERE all_inputs_built = 1 (datastore <sqlite-datastore>) event arguments) - (call-with-writer-worker-thread/delay-logging + (call-with-writer-thread/delay-logging datastore (lambda (db) (insert-unprocessed-hook-event db @@ -3121,7 +3122,7 @@ VALUES (:event, :arguments)" (define-method (datastore-count-unprocessed-hook-events (datastore <sqlite-datastore>)) - (call-with-worker-thread/delay-logging + (call-with-thread/delay-logging (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3145,7 +3146,7 @@ SELECT event, COUNT(*) FROM unprocessed_hook_events GROUP BY event" (datastore <sqlite-datastore>) event limit) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3179,7 +3180,7 @@ LIMIT :limit" (define-method (datastore-find-unprocessed-hook-event (datastore <sqlite-datastore>) id) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3206,7 +3207,7 @@ WHERE id = :id" (define-method (datastore-delete-unprocessed-hook-event (datastore <sqlite-datastore>) id) - (call-with-writer-worker-thread + (call-with-writer-thread datastore (lambda (db) (let ((statement @@ -3226,7 +3227,7 @@ DELETE FROM unprocessed_hook_events WHERE id = :id" (define-method (datastore-count-allocated-builds (datastore <sqlite-datastore>)) - (call-with-worker-thread/delay-logging + (call-with-thread/delay-logging (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3249,7 +3250,7 @@ SELECT agent_id, COUNT(*) FROM allocated_builds GROUP BY agent_id" (define-method (datastore-agent-requested-systems (datastore <sqlite-datastore>) agent-id) - (call-with-worker-thread/delay-logging + (call-with-thread/delay-logging (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3324,7 +3325,7 @@ INSERT INTO build_allocation_agent_requested_systems (agent_id, system_id) VALUE (define-method (datastore-fetch-build-to-allocate (datastore <sqlite-datastore>) build-id) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3353,7 +3354,7 @@ WHERE builds.uuid = :uuid (datastore <sqlite-datastore>) agent-id derivation-id) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3384,7 +3385,7 @@ WHERE build_derivation_outputs.derivation_id = :derivation_id (datastore <sqlite-datastore>) agent-id build-uuids) - (call-with-writer-worker-thread + (call-with-writer-thread datastore (lambda (db) (sqlite-exec @@ -3409,7 +3410,7 @@ INSERT INTO allocated_builds (build_id, agent_id) VALUES " rest) (apply (lambda* (agent-id #:key limit) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3473,7 +3474,7 @@ LIMIT :limit" (define-method (datastore-list-agent-builds (datastore <sqlite-datastore>) agent-id) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3512,7 +3513,7 @@ WHERE allocated_builds.agent_id = :agent_id" (define-method (datastore-agent-for-build (datastore <sqlite-datastore>) build-uuid) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3669,7 +3670,7 @@ WHERE name = :name" (define-method (datastore-find-derivation (datastore <sqlite-datastore>) name) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (db-find-derivation db name)))) @@ -3677,7 +3678,7 @@ WHERE name = :name" (define-method (datastore-find-derivation-outputs (datastore <sqlite-datastore>) derivation-name) - (call-with-worker-thread/delay-logging + (call-with-thread/delay-logging (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3710,7 +3711,7 @@ WHERE derivation_id = :derivation_id" (define-method (datastore-find-derivation-output-details (datastore <sqlite-datastore>) derivation-name) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3753,7 +3754,7 @@ WHERE derivation_id = :derivation_id" (define-method (datastore-list-unbuilt-derivation-outputs (datastore <sqlite-datastore>) derivation-name) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3787,7 +3788,7 @@ WHERE derivation_id = :derivation_id" (define-method (datastore-list-build-outputs (datastore <sqlite-datastore>) build-uuid) - (call-with-worker-thread/delay-logging + (call-with-thread/delay-logging (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3832,7 +3833,7 @@ WHERE builds.id = :build_id" (define-method (datastore-find-derivation-system (datastore <sqlite-datastore>) derivation-name) - (call-with-worker-thread/delay-logging + (call-with-thread/delay-logging (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3856,7 +3857,7 @@ WHERE name = :name" (define-method (datastore-find-derivation-inputs (datastore <sqlite-datastore>) derivation-name) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3897,7 +3898,7 @@ WHERE derivations.id = :derivation_id" (define-method (datastore-find-recursive-derivation-input-outputs (datastore <sqlite-datastore>) derivation-name) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -3939,7 +3940,7 @@ INNER JOIN outputs (datastore <sqlite-datastore>) start-derivation-name output) - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (let ((statement @@ -4377,14 +4378,14 @@ VALUES (:build_id, :derived_priority, :all_inputs_built)" (lambda* (uuid drv-name priority defer-until #:key skip-updating-other-build-derived-priorities) (define system-id - (call-with-worker-thread + (call-with-thread (slot-ref datastore 'worker-reader-thread-set) (lambda (db) (db-system->system-id db (datastore-find-derivation-system datastore drv-name))))) - (call-with-worker-thread/delay-logging + (call-with-thread/delay-logging datastore (lambda (db) (let* ((build-id (insert-build db drv-name uuid priority diff --git a/guix-dev.scm b/guix-dev.scm index dab7e89..011d9e0 100644 --- a/guix-dev.scm +++ b/guix-dev.scm @@ -45,7 +45,7 @@ (srfi srfi-1)) (define guile-knots - (let ((commit "dcb56ee2c5ac3e283cb46841766e7282f3c2c52e") + (let ((commit "d572f591a3c136bfc7b23160e16381c92588f8d9") (revision "1")) (package (name "guile-knots") @@ -57,7 +57,7 @@ (commit commit))) (sha256 (base32 - "04z48572canx35hl0kfli3pf3g3m6184zvmnpyg1rbwla6g5z1fk")) + "0g85frfniblxb2cl81fg558ic3cxvla7fvml08scjgbbxn8151gv")) (file-name (string-append name "-" version "-checkout")))) (build-system gnu-build-system) (native-inputs |