diff options
author | Christopher Baines <mail@cbaines.net> | 2024-01-30 10:05:07 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2024-01-30 10:05:07 +0000 |
commit | d9fa7947c25d0624c568f744ad2a2683a43e5644 (patch) | |
tree | c3dc0aa1155700cd90400f0e324ef5c34664f2ca /guix-build-coordinator/datastore | |
parent | dc04b747048638a753bd044646306fcdd33c241a (diff) | |
download | build-coordinator-d9fa7947c25d0624c568f744ad2a2683a43e5644.tar build-coordinator-d9fa7947c25d0624c568f744ad2a2683a43e5644.tar.gz |
Expose the derived priorities for builds
Diffstat (limited to 'guix-build-coordinator/datastore')
-rw-r--r-- | guix-build-coordinator/datastore/sqlite.scm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm index f10af88..e5ae519 100644 --- a/guix-build-coordinator/datastore/sqlite.scm +++ b/guix-build-coordinator/datastore/sqlite.scm @@ -39,6 +39,7 @@ datastore-for-each-build datastore-find-build datastore-fold-builds + datastore-find-unprocessed-build-entry datastore-insert-build-tags datastore-fetch-build-tags datastore-find-build-result @@ -1286,6 +1287,35 @@ INNER JOIN related_derivations result))))) +(define-method (datastore-find-unprocessed-build-entry + (datastore <sqlite-datastore>) + uuid) + (call-with-worker-thread/delay-logging + (slot-ref datastore 'worker-reader-thread-channel) + (lambda (db) + (let ((statement + (sqlite-prepare + db + " +SELECT derived_priority, all_inputs_built +FROM unprocessed_builds_with_derived_priorities +WHERE build_id = :build_id" + #:cache? #t))) + + (sqlite-bind-arguments + statement + #:build_id (db-find-build-id db uuid)) + + (match (sqlite-step-and-reset statement) + (#(derived-priority all-inputs-built) + `((derived-priority . ,derived-priority) + (all-inputs-build . ,(cond + ((= 0 all-inputs-built) #f) + ((= 1 all-inputs-built) #t) + (else + (error "unknown processed value")))))) + (#f #f)))))) + (define-method (datastore-insert-build-tags (datastore <sqlite-datastore>) build-uuid |