From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Baines Subject: [PATCH v3 2/2] Support publishing evaluation events Date: Sat, 28 Dec 2019 19:05:54 +0000 Message-ID: <20191228190554.7920-2-mail@cbaines.net> References: <87mudvrhim.fsf@cbaines.net> <20191228190554.7920-1-mail@cbaines.net> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:56415) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilHPS-0001Vm-7W for guix-devel@gnu.org; Sat, 28 Dec 2019 14:05:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ilHPQ-0004I0-RS for guix-devel@gnu.org; Sat, 28 Dec 2019 14:05:57 -0500 Received: from mira.cbaines.net ([212.71.252.8]:56190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ilHPQ-00048M-JT for guix-devel@gnu.org; Sat, 28 Dec 2019 14:05:56 -0500 Received: from localhost (140.126.9.51.dyn.plus.net [51.9.126.140]) by mira.cbaines.net (Postfix) with ESMTPSA id 1A45F17989 for ; Sat, 28 Dec 2019 19:05:55 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 498170c7 for ; Sat, 28 Dec 2019 19:05:54 +0000 (UTC) In-Reply-To: <20191228190554.7920-1-mail@cbaines.net> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org * src/cuirass/database.scm (db-add-evaluation): Record the creation of ne= w evaluations as events. (db-set-evaluation-done): Record when evaluations finish as an event. * src/cuirass/http.scm (url-handler): Add a new /api/evaluation-events pa= ge. --- src/cuirass/database.scm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm index 924c72a..2e8e789 100644 --- a/src/cuirass/database.scm +++ b/src/cuirass/database.scm @@ -408,7 +408,12 @@ VALUES (" spec-name ", true);") (if (null? new-checkouts) (begin (sqlite-exec db "ROLLBACK;") #f) - (begin (sqlite-exec db "COMMIT;") + (begin (db-add-event 'evaluation + (time-second (current-time time-utc)) + `((#:evaluation . ,eval-id) + (#:specification . ,spec-name) + (#:in_progress . #t))) + (sqlite-exec db "COMMIT;") eval-id))))) =20 (define (db-set-evaluations-done) @@ -418,7 +423,11 @@ VALUES (" spec-name ", true);") (define (db-set-evaluation-done eval-id) (with-db-critical-section db (sqlite-exec db "UPDATE Evaluations SET in_progress =3D false -WHERE id =3D " eval-id ";"))) +WHERE id =3D " eval-id ";") + (db-add-event 'evaluation + (time-second (current-time time-utc)) + `((#:evaluation . ,eval-id) + (#:in_progress . #f))))) =20 (define-syntax-rule (with-database body ...) "Run BODY with %DB-CHANNEL being dynamically bound to a channel implem= enting --=20 2.24.1