aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-04-11 18:31:24 +0100
committerChristopher Baines <mail@cbaines.net>2023-04-11 18:31:24 +0100
commitc501076fb082368325920461d8c6c6de21316dd0 (patch)
treea6f94050826cbb5609ac6a0f7fe0f72c4060d6c8
parent967984886623e69838f5fb044f59719142e96f51 (diff)
downloadbuild-coordinator-c501076fb082368325920461d8c6c6de21316dd0.tar
build-coordinator-c501076fb082368325920461d8c6c6de21316dd0.tar.gz
Remove datastore-select-allocated-builds
As it's a less well named copy of datastore-list-agent-builds.
-rw-r--r--guix-build-coordinator/client-communication.scm2
-rw-r--r--guix-build-coordinator/coordinator.scm2
-rw-r--r--guix-build-coordinator/datastore.scm1
-rw-r--r--guix-build-coordinator/datastore/sqlite.scm42
4 files changed, 2 insertions, 45 deletions
diff --git a/guix-build-coordinator/client-communication.scm b/guix-build-coordinator/client-communication.scm
index 37fd322..829470a 100644
--- a/guix-build-coordinator/client-communication.scm
+++ b/guix-build-coordinator/client-communication.scm
@@ -222,7 +222,7 @@
`(,@agent
(allocated_builds
. ,(list->vector
- (datastore-select-allocated-builds
+ (datastore-list-agent-builds
datastore
(assq-ref agent 'uuid))))
(tags . ,(vector-map
diff --git a/guix-build-coordinator/coordinator.scm b/guix-build-coordinator/coordinator.scm
index fef81c3..c66e89a 100644
--- a/guix-build-coordinator/coordinator.scm
+++ b/guix-build-coordinator/coordinator.scm
@@ -1174,7 +1174,7 @@
datastore
(lambda _
(let* ((initially-allocated-builds
- (datastore-select-allocated-builds datastore agent))
+ (datastore-list-agent-builds datastore agent))
(start-count
(length initially-allocated-builds))
(target-count (or max-builds
diff --git a/guix-build-coordinator/datastore.scm b/guix-build-coordinator/datastore.scm
index d9cc772..a12c41a 100644
--- a/guix-build-coordinator/datastore.scm
+++ b/guix-build-coordinator/datastore.scm
@@ -93,7 +93,6 @@
(re-export datastore-fetch-build-to-allocate)
(re-export datastore-insert-to-allocated-builds)
(re-export datastore-remove-builds-from-plan)
-(re-export datastore-select-allocated-builds)
(re-export datastore-list-allocation-plan-builds)
(define* (database-uri->datastore database
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm
index 2016443..b104528 100644
--- a/guix-build-coordinator/datastore/sqlite.scm
+++ b/guix-build-coordinator/datastore/sqlite.scm
@@ -103,7 +103,6 @@
datastore-fetch-build-to-allocate
datastore-insert-to-allocated-builds
datastore-remove-builds-from-plan
- datastore-select-allocated-builds
datastore-list-allocation-plan-builds))
(define-class <sqlite-datastore> (<abstract-datastore>)
@@ -3411,47 +3410,6 @@ WHERE build_id IN ("
", ")
")")))))
-(define-method (datastore-select-allocated-builds
- (datastore <sqlite-datastore>)
- agent-id)
- (call-with-worker-thread/delay-logging
- (slot-ref datastore 'worker-reader-thread-channel)
- (lambda (db)
- (let ((statement
- (sqlite-prepare
- db
- "
-SELECT builds.uuid, derivations.name, builds.priority
-FROM allocated_builds
-INNER JOIN builds
- ON allocated_builds.build_id = builds.id
-INNER JOIN derivations
- ON builds.derivation_id = derivations.id
-WHERE agent_id = :agent_id"
- #:cache? #t)))
-
- (sqlite-bind-arguments
- statement
- #:agent_id agent-id)
-
- (let ((result
- (sqlite-fold
- (lambda (row result)
- (cons
- (match row
- (#(uuid derivation_name priority)
- `((uuid . ,uuid)
- ;; TODO Switch this to derivation_name
- (derivation-name . ,derivation_name)
- (priority . ,priority))))
- result))
- '()
- statement)))
-
- (sqlite-reset statement)
-
- result)))))
-
(define-method (datastore-list-allocation-plan-builds
(datastore <sqlite-datastore>)
.