Skip to content
Snippets Groups Projects
Unverified Commit 4a0cea22 authored by Mathieu Othacehe's avatar Mathieu Othacehe
Browse files

database: Add "db-restart-evaluation!" support.

* src/cuirass/database.scm (db-restart-evaluation!): New procedure.
* tests/database.scm (db-restart-evaluation!): New test.
parent 04185edb
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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;"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment