diff options
author | Christopher Baines <mail@cbaines.net> | 2020-12-02 19:40:27 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-12-02 19:40:27 +0000 |
commit | 7fd69fd59ed2a06e6e4f4231b6087e553eeb6e6c (patch) | |
tree | 0d520be2ac49cb0a8c84c3bd42c6a7daf518321b | |
parent | 6aa59c026dcc9544c82ebc9e0df1a597ecf13fa3 (diff) | |
download | build-coordinator-7fd69fd59ed2a06e6e4f4231b6087e553eeb6e6c.tar build-coordinator-7fd69fd59ed2a06e6e4f4231b6087e553eeb6e6c.tar.gz |
Improve how requested systems are handled in build allocation
Just join against the database table, rather than using the values.
-rw-r--r-- | guix-build-coordinator/coordinator.scm | 1 | ||||
-rw-r--r-- | guix-build-coordinator/datastore/sqlite.scm | 14 |
2 files changed, 6 insertions, 9 deletions
diff --git a/guix-build-coordinator/coordinator.scm b/guix-build-coordinator/coordinator.scm index 4bda54a..88e40a4 100644 --- a/guix-build-coordinator/coordinator.scm +++ b/guix-build-coordinator/coordinator.scm @@ -520,7 +520,6 @@ (datastore-allocate-builds-to-agent (build-coordinator-datastore build-coordinator) agent - systems max-builds deprecated-requested-count)))) diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm index fdedddc..e5daf6d 100644 --- a/guix-build-coordinator/datastore/sqlite.scm +++ b/guix-build-coordinator/datastore/sqlite.scm @@ -1734,7 +1734,6 @@ INSERT INTO build_allocation_agent_requested_systems (agent_id, system) VALUES " (define-method (datastore-allocate-builds-to-agent (datastore <sqlite-datastore>) agent-id - systems max-builds deprecated-requested-count) (define (fetch-build db) @@ -1742,17 +1741,19 @@ INSERT INTO build_allocation_agent_requested_systems (agent_id, system) VALUES " (sqlite-prepare db ;; This needs to guard against the plan being out of date - (simple-format #f " + " SELECT builds.uuid, builds.derivation_name FROM builds INNER JOIN build_allocation_plan ON builds.uuid = build_allocation_plan.build_id INNER JOIN derivations ON builds.derivation_name = derivations.name +INNER JOIN build_allocation_agent_requested_systems + ON build_allocation_agent_requested_systems.agent_id = :agent_id + AND build_allocation_agent_requested_systems.system = derivations.system WHERE build_allocation_plan.agent_id = :agent_id AND builds.processed = 0 AND builds.uuid NOT IN (SELECT build_id FROM allocated_builds) - AND derivations.system IN (~A) AND NOT EXISTS ( SELECT 1 FROM derivation_outputs AS build_derivation_outputs @@ -1769,11 +1770,8 @@ WHERE build_allocation_plan.agent_id = :agent_id ) ORDER BY build_allocation_plan.ordering ASC LIMIT 1" - (string-join - (map (lambda (system) - (string-append "'" system "'")) - systems) - ","))))) + #:cache? #t))) + (sqlite-bind-arguments statement #:agent_id agent-id) |