Restructure shared types and db columns
Now, the server sends the runner pretty much all run metadata. This way, the reservation the server makes for the runner is accurate, providing the runner responds with the same metadata it was sent. It also means that only the server's system clock is relevant for tie breakers, and a run's duration spans from the moment it is reserved to the moment it is saved. Also, the bench method is now always called `bench_method` and a human-readable description is stored in the database for each run.
This commit is contained in:
parent
53be0338f2
commit
c7a89867a7
8 changed files with 121 additions and 98 deletions
|
|
@ -64,12 +64,19 @@ async fn get_workers(
|
|||
let status = match &info.status {
|
||||
WorkerStatus::Idle => Status::Idle,
|
||||
WorkerStatus::Busy => Status::Busy,
|
||||
WorkerStatus::Working(run) => {
|
||||
let message =
|
||||
sqlx::query_scalar!("SELECT message FROM commits WHERE hash = ?", run.hash)
|
||||
.fetch_one(db)
|
||||
.await?;
|
||||
Status::Working(RunLink::new(base, run.id.clone(), &run.hash, &message))
|
||||
WorkerStatus::Working(unfinished) => {
|
||||
let message = sqlx::query_scalar!(
|
||||
"SELECT message FROM commits WHERE hash = ?",
|
||||
unfinished.run.hash
|
||||
)
|
||||
.fetch_one(db)
|
||||
.await?;
|
||||
Status::Working(RunLink::new(
|
||||
base,
|
||||
unfinished.run.id.clone(),
|
||||
&unfinished.run.hash,
|
||||
&message,
|
||||
))
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -89,9 +96,9 @@ async fn get_queue(
|
|||
// Group workers by commit hash
|
||||
let mut workers_by_commit: HashMap<String, Vec<WorkerLink>> = HashMap::new();
|
||||
for (name, info) in workers {
|
||||
if let WorkerStatus::Working(run) = &info.status {
|
||||
if let WorkerStatus::Working(unfinished) = &info.status {
|
||||
workers_by_commit
|
||||
.entry(run.hash.clone())
|
||||
.entry(unfinished.run.hash.clone())
|
||||
.or_default()
|
||||
.push(WorkerLink::new(base, name.clone()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue