[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: database: Add db-restart-build! support.
From: |
Mathieu Othacehe |
Subject: |
branch master updated: database: Add db-restart-build! support. |
Date: |
Wed, 17 Feb 2021 13:12:24 -0500 |
This is an automated email from the git hooks/post-receive script.
mothacehe pushed a commit to branch master
in repository guix-cuirass.
The following commit(s) were added to refs/heads/master by this push:
new 31342ff database: Add db-restart-build! support.
31342ff is described below
commit 31342ff80fc92f41d5627bc132978c65f4421d2f
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Wed Feb 17 19:11:38 2021 +0100
database: Add db-restart-build! support.
* src/cuirass/database.scm (db-restart-build!): New procedure.
* tests/database.scm (db-restart-build!): New test.
---
src/cuirass/database.scm | 8 ++++++++
tests/database.scm | 6 ++++++
2 files changed, 14 insertions(+)
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index 38abce1..bd1b038 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -69,6 +69,7 @@
db-register-builds
db-update-build-status!
db-update-build-worker!
+ db-restart-build!
db-get-build-products
db-get-builds-by-search
db-get-builds
@@ -833,6 +834,13 @@ UPDATE Builds SET stoptime =" now
(exec-query/bind db "UPDATE Builds SET worker=" worker
"WHERE derivation=" drv ";")))
+(define (db-restart-build! build-id)
+ "Restart the build with BUILD-ID id."
+ (with-db-worker-thread db
+ (exec-query/bind db "UPDATE Builds SET status="
+ (build-status scheduled)
+ "WHERE id=" build-id ";")))
+
(define (query->bind-arguments query-string)
"Return a list of keys to query strings by parsing QUERY-STRING."
(define status-values
diff --git a/tests/database.scm b/tests/database.scm
index ec77ba4..7bb08ea 100644
--- a/tests/database.scm
+++ b/tests/database.scm
@@ -490,6 +490,12 @@ timestamp, checkouttime, evaltime) VALUES ('guix', 0, 0,
0, 0);")
(db-update-build-status! "/new-build.drv" 1)
(assq-ref (db-get-build "/new-build.drv") #:weather)))
+ (test-assert "db-restart-build!"
+ (let ((build (db-get-build "/new-build.drv")))
+ (db-restart-build! (assq-ref build #:id))
+ (eq? (assq-ref (db-get-build "/new-build.drv") #:status)
+ (build-status scheduled))))
+
(test-assert "db-close"
(begin
(exec-query (%db) (format #f "DROP OWNED BY CURRENT_USER;"))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: database: Add db-restart-build! support.,
Mathieu Othacehe <=