From d493a58823aed8c556bf795d02207e57718b96c9 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Tue, 26 Jul 2016 16:53:57 +0200 Subject: schema: Separate "Derivations" from "Evaluations". * src/schema.sql (Derivations): New table. (Evaluations): Remove 'derivation' and 'job_name' columns. Add 'id' column. * src/cuirass/database.scm (db-add-evaluation): Adapt. (db-get-derivation, db-add-derivation): New procedures. (evaluation-exists?, db-get-evaluation): Delete. * bin/evaluate.in (main): Adapt. * tests/database.scm ("sqlite-exec"): Likewise. ("db-add-derivation", "db-get-derivation"): New tests. ("db-add-evaluation", "db-get-evaluation"): Delete. --- bin/evaluate.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/evaluate.in b/bin/evaluate.in index 878732f..6c5a53f 100644 --- a/bin/evaluate.in +++ b/bin/evaluate.in @@ -57,17 +57,17 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@" (exit 1))) (parameterize ((%package-database database)) ;; Call the entry point of FILE and print the resulting job sexp. - (let* ((proc (module-ref %user-module 'hydra-jobs)) - (thunks (proc store (assq-ref spec #:arguments))) - (db (db-open)) - (spec-id (assq-ref spec #:id))) + (let* ((proc (module-ref %user-module 'hydra-jobs)) + (thunks (proc store (assq-ref spec #:arguments))) + (db (db-open)) + (spec-id (assq-ref spec #:id)) + (eval-id (db-add-evaluation db spec-id))) (pretty-print (map (λ (thunk) (let* ((job (call-with-time-display thunk)) ;; Keep track of SPEC id in the returned jobs. - (job* (acons #:spec-id spec-id job))) - (or (evaluation-exists? db job*) - (db-add-evaluation db job*)) + (job* (acons #:eval-id eval-id job))) + (db-add-derivation db job*) job*)) thunks) stdout) -- cgit v1.2.3