guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: database: Add "db-restart-evaluation!" support.


From: Mathieu Othacehe
Subject: branch master updated: database: Add "db-restart-evaluation!" support.
Date: Thu, 18 Feb 2021 09:13:30 -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 4a0cea2  database: Add "db-restart-evaluation!" support.
4a0cea2 is described below

commit 4a0cea2245fb91e6f8feac72e83bb862981a80ac
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Thu Feb 18 15:12:54 2021 +0100

    database: Add "db-restart-evaluation!" support.
    
    * src/cuirass/database.scm (db-restart-evaluation!): New procedure.
    * tests/database.scm (db-restart-evaluation!): 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 bd1b038..2f12ed9 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -70,6 +70,7 @@
             db-update-build-status!
             db-update-build-worker!
             db-restart-build!
+            db-restart-evaluation!
             db-get-build-products
             db-get-builds-by-search
             db-get-builds
@@ -841,6 +842,13 @@ UPDATE Builds SET stoptime =" now
                      (build-status scheduled)
                      "WHERE id=" build-id ";")))
 
+(define (db-restart-evaluation! eval-id)
+  "Restart the evaluation with EVAL-ID id."
+  (with-db-worker-thread db
+    (exec-query/bind db "UPDATE Builds SET status="
+                     (build-status scheduled)
+                     "WHERE evaluation=" eval-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 7bb08ea..8c39216 100644
--- a/tests/database.scm
+++ b/tests/database.scm
@@ -496,6 +496,12 @@ timestamp, checkouttime, evaltime) VALUES ('guix', 0, 0, 
0, 0);")
       (eq? (assq-ref (db-get-build "/new-build.drv") #:status)
            (build-status scheduled))))
 
+  (test-assert "db-restart-evaluation!"
+    (let ((build (db-get-build "/old-build.drv")))
+      (db-restart-evaluation! (assq-ref build #:eval-id))
+      (eq? (assq-ref (db-get-build "/old-build.drv") #:status)
+           (build-status scheduled))))
+
   (test-assert "db-close"
     (begin
       (exec-query (%db) (format #f "DROP OWNED BY CURRENT_USER;"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]