diff options
author | Christopher Baines <mail@cbaines.net> | 2019-10-28 07:56:51 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-01-16 08:33:03 +0000 |
commit | 267649c9f0ade7728bb622ce9565a2a8af7e1db0 (patch) | |
tree | 6bbc89494e0c9196d8db1a4fa2744323a93c7480 /src | |
parent | 12def48b3bf665edcf227ab3afbcdeda87198b61 (diff) | |
download | cuirass-267649c9f0ade7728bb622ce9565a2a8af7e1db0.tar cuirass-267649c9f0ade7728bb622ce9565a2a8af7e1db0.tar.gz |
Support publishing evaluation events
* src/cuirass/database.scm (db-add-evaluation): Record the creation of new
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 page.
Diffstat (limited to 'src')
-rw-r--r-- | src/cuirass/database.scm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm index 9cd2e8f..ab6a4c7 100644 --- a/src/cuirass/database.scm +++ b/src/cuirass/database.scm @@ -412,7 +412,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))))) (define (db-set-evaluations-done) @@ -422,7 +427,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 = false -WHERE id = " eval-id ";"))) +WHERE id = " eval-id ";") + (db-add-event 'evaluation + (time-second (current-time time-utc)) + `((#:evaluation . ,eval-id) + (#:in_progress . #f))))) (define-syntax-rule (with-database body ...) "Run BODY with %DB-CHANNEL being dynamically bound to a channel implementing |