Rename runners to workers

This commit is contained in:
Joscha 2023-08-11 02:03:32 +02:00
parent 78f945647c
commit 6f4793bcf2
20 changed files with 233 additions and 237 deletions

View file

@ -1,4 +1,4 @@
//! Data structures modelling the communication between server and runner.
//! Data structures modelling the communication between server and worker.
use std::collections::HashMap;
@ -62,36 +62,36 @@ pub struct FinishedRun {
#[derive(Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[serde(tag = "type")]
pub enum RunnerStatus {
/// The runner is not performing any work.
pub enum WorkerStatus {
/// The worker is not performing any work.
Idle,
/// The runner is performing work for another server.
/// The worker is performing work for another server.
Busy,
/// The runner is performing work for the current server.
/// The worker is performing work for the current server.
Working(UnfinishedRun),
}
#[derive(Clone, Serialize, Deserialize)]
pub struct RunnerRequest {
/// Additional free-form info about the runner.
pub struct WorkerRequest {
/// Additional free-form info about the worker.
///
/// This could for example be used to describe the runner's system specs.
/// This could for example be used to describe the worker's system specs.
pub info: Option<String>,
/// Secret for preventing name collisions.
pub secret: String,
/// What the runner is currently working on.
pub status: RunnerStatus,
/// What the worker is currently working on.
pub status: WorkerStatus,
/// Whether the runner wants new work from the server.
/// Whether the worker wants new work from the server.
///
/// If the server has a commit available, it should respond with a non-null
/// [`Response::work`].
#[serde(default, skip_serializing_if = "is_false")]
pub request_work: bool,
/// The runner has finished a run and wants to submit the results.
/// The worker has finished a run and wants to submit the results.
#[serde(skip_serializing_if = "Option::is_none")]
pub submit_work: Option<FinishedRun>,
}
@ -116,20 +116,20 @@ pub struct Work {
#[derive(Serialize, Deserialize)]
pub struct ServerResponse {
/// Work the runner requested using [`Request::request_work].
/// Work the worker requested using [`Request::request_work].
///
/// The runner may ignore this work and do something else. However, until
/// the next update request sent by the runner, the server will consider the
/// runner as preparing to work on the commit, and will not give out the
/// same commit to other runners.
/// The worker may ignore this work and do something else. However, until
/// the next update request sent by the worker, the server will consider the
/// worker as preparing to work on the commit, and will not give out the
/// same commit to other workers.
#[serde(skip_serializing_if = "Option::is_none")]
pub work: Option<Work>,
/// The runner should abort the current run.
/// The worker should abort the current run.
///
/// The server may send this because it detected the runner is benchmarking
/// the same commit as another runner and has broken the tie in favor of the
/// other runner. The runner may continue the run despite this flag.
/// The server may send this because it detected the worker is benchmarking
/// the same commit as another worker and has broken the tie in favor of the
/// other worker. The worker may continue the run despite this flag.
#[serde(default, skip_serializing_if = "is_false")]
pub abort_work: bool,
}