From dd073b4c0d86e77c18620116b956b9640ba5cbac Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 14 Aug 2023 14:26:53 +0200 Subject: [PATCH] Include worker name and info in run --- ...2c8c6fb5eaa63a4965082f3c54390ee71e4dd3a15.json | 12 ++++++++++++ ...d7a74668a82fabb1d83bdfc8bf763bff733b3388c.json | 12 ------------ migrations/20230809141314_runs.sql | 2 ++ src/server/web/api/worker.rs | 15 ++++++++++++--- 4 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 .sqlx/query-7af4a1edc6f7cf718fee6562c8c6fb5eaa63a4965082f3c54390ee71e4dd3a15.json delete mode 100644 .sqlx/query-d1e7da8b6a2018e621e3fd6d7a74668a82fabb1d83bdfc8bf763bff733b3388c.json diff --git a/.sqlx/query-7af4a1edc6f7cf718fee6562c8c6fb5eaa63a4965082f3c54390ee71e4dd3a15.json b/.sqlx/query-7af4a1edc6f7cf718fee6562c8c6fb5eaa63a4965082f3c54390ee71e4dd3a15.json new file mode 100644 index 0000000..3a81052 --- /dev/null +++ b/.sqlx/query-7af4a1edc6f7cf718fee6562c8c6fb5eaa63a4965082f3c54390ee71e4dd3a15.json @@ -0,0 +1,12 @@ +{ + "db_name": "SQLite", + "query": "INSERT INTO runs ( id, hash, bench_method, worker_name, worker_info, start, end, exit_code ) VALUES (?, ?, ?, ?, ?, ?, ?, ?) ", + "describe": { + "columns": [], + "parameters": { + "Right": 8 + }, + "nullable": [] + }, + "hash": "7af4a1edc6f7cf718fee6562c8c6fb5eaa63a4965082f3c54390ee71e4dd3a15" +} diff --git a/.sqlx/query-d1e7da8b6a2018e621e3fd6d7a74668a82fabb1d83bdfc8bf763bff733b3388c.json b/.sqlx/query-d1e7da8b6a2018e621e3fd6d7a74668a82fabb1d83bdfc8bf763bff733b3388c.json deleted file mode 100644 index f6b891f..0000000 --- a/.sqlx/query-d1e7da8b6a2018e621e3fd6d7a74668a82fabb1d83bdfc8bf763bff733b3388c.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "SQLite", - "query": "INSERT INTO runs ( id, hash, bench_method, start, end, exit_code ) VALUES (?, ?, ?, ?, ?, ?) ", - "describe": { - "columns": [], - "parameters": { - "Right": 6 - }, - "nullable": [] - }, - "hash": "d1e7da8b6a2018e621e3fd6d7a74668a82fabb1d83bdfc8bf763bff733b3388c" -} diff --git a/migrations/20230809141314_runs.sql b/migrations/20230809141314_runs.sql index a123830..a75750a 100644 --- a/migrations/20230809141314_runs.sql +++ b/migrations/20230809141314_runs.sql @@ -2,6 +2,8 @@ CREATE TABLE runs ( id TEXT NOT NULL PRIMARY KEY, hash TEXT NOT NULL, bench_method TEXT NOT NULL, + worker_name TEXT NOT NULL, + worker_info TEXT, start TEXT NOT NULL, end TEXT NOT NULL, exit_code INT NOT NULL, diff --git a/src/server/web/api/worker.rs b/src/server/web/api/worker.rs index e29a842..64cfcd6 100644 --- a/src/server/web/api/worker.rs +++ b/src/server/web/api/worker.rs @@ -31,7 +31,12 @@ use crate::{ somehow, }; -async fn save_work(finished: FinishedRun, db: &SqlitePool) -> somehow::Result<()> { +async fn save_work( + finished: FinishedRun, + worker_name: &str, + worker_info: &Option, + db: &SqlitePool, +) -> somehow::Result<()> { let mut tx = db.begin().await?; let conn = tx.acquire().await?; @@ -47,15 +52,19 @@ async fn save_work(finished: FinishedRun, db: &SqlitePool) -> somehow::Result<() id, \ hash, \ bench_method, \ + worker_name, \ + worker_info, \ start, \ end, \ exit_code \ ) \ - VALUES (?, ?, ?, ?, ?, ?) \ + VALUES (?, ?, ?, ?, ?, ?, ?, ?) \ ", finished.run.id, finished.run.hash, bench_method, + worker_name, + worker_info, finished.run.start, end, finished.exit_code, @@ -133,7 +142,7 @@ pub async fn post_api_worker_status( }; if let Some(run) = request.submit_run { - save_work(run, &db).await?; + save_work(run, &name, &request.info, &db).await?; } // Fetch queue