diff options
author | Christopher Baines <mail@cbaines.net> | 2023-03-24 09:45:10 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-03-24 09:51:28 +0000 |
commit | d6ae42f19691267d915cd66174436f33debabec0 (patch) | |
tree | bdcac7bd56cb06a2a62631e72564c7a51716cbf3 /guix-build-coordinator/datastore | |
parent | 024761d432ff84e197b49846c71ac34f5703df38 (diff) | |
download | build-coordinator-d6ae42f19691267d915cd66174436f33debabec0.tar build-coordinator-d6ae42f19691267d915cd66174436f33debabec0.tar.gz |
Add processor count to the agent status
This is useful when interpreting the load information.
Diffstat (limited to 'guix-build-coordinator/datastore')
-rw-r--r-- | guix-build-coordinator/datastore/sqlite.scm | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm index c2dc3de..36a9e5c 100644 --- a/guix-build-coordinator/datastore/sqlite.scm +++ b/guix-build-coordinator/datastore/sqlite.scm @@ -687,7 +687,7 @@ UPDATE agents SET active = :active WHERE id = :uuid" (sqlite-prepare db " -SELECT status, load_average_1min, timestamp +SELECT status, load_average_1min, timestamp, processor_count FROM agent_status WHERE agent_id = :agent_id" #:cache? #t))) @@ -697,19 +697,22 @@ WHERE agent_id = :agent_id" #:agent_id agent-id) (match (sqlite-step statement) - (#(status 1min_load_average timestamp) + (#(status 1min_load_average timestamp + processor_count) (sqlite-reset statement) `((status . ,status) (1min_load_average . ,1min_load_average) - (timestamp . ,timestamp))) + (timestamp . ,timestamp) + (processor_count . ,processor_count))) (_ #f)))))) (define-method (datastore-update-agent-status (datastore <sqlite-datastore>) agent-uuid status - 1min-load-average) + 1min-load-average + processor-count) (call-with-worker-thread (slot-ref datastore 'worker-writer-thread-channel) (lambda (db) @@ -729,14 +732,15 @@ DELETE FROM agent_status WHERE agent_id = :uuid" (sqlite-prepare db " -INSERT INTO agent_status (agent_id, status, load_average_1min) - VALUES (:uuid, :status, :load)" +INSERT INTO agent_status (agent_id, status, load_average_1min, processor_count) + VALUES (:uuid, :status, :load, :processor_count)" #:cache? #t))) (sqlite-bind-arguments statement #:uuid agent-uuid #:status status - #:load 1min-load-average) + #:load 1min-load-average + #:processor_count processor-count) (sqlite-step statement) (sqlite-reset statement)))) |