Add optional run end time override

This commit is contained in:
Joscha 2023-08-14 14:15:38 +02:00
parent 6b8ae19ba5
commit 01124d719b
3 changed files with 12 additions and 1 deletions

View file

@ -35,7 +35,7 @@ async fn save_work(finished: FinishedRun, db: &SqlitePool) -> somehow::Result<()
let mut tx = db.begin().await?;
let conn = tx.acquire().await?;
let end = OffsetDateTime::now_utc();
let end = finished.end.unwrap_or_else(OffsetDateTime::now_utc);
let bench_method = match finished.run.bench_method {
BenchMethod::Internal => "internal".to_string(),
BenchMethod::Repo { hash } => format!("bench repo, hash {hash}"),

View file

@ -65,10 +65,20 @@ pub struct UnfinishedRun {
pub struct FinishedRun {
#[serde(flatten)]
pub run: Run,
/// Override the server's end time.
///
/// Should not be used in normal operation, but can be used when importing
/// completed runs from other sources.
#[serde(skip_serializing_if = "Option::is_none")]
pub end: Option<OffsetDateTime>,
#[serde(default)]
pub exit_code: i32,
#[serde(default)]
pub output: Vec<(Source, String)>,
#[serde(default)]
pub measurements: HashMap<String, Measurement>,
}

View file

@ -97,6 +97,7 @@ impl RunInProgress {
Some(FinishedRun {
run: self.run.clone(),
end: None,
exit_code: finished.exit_code,
output,
measurements: finished.measurements,