From dbb9d487b33e9565108b10a30906c6b57fc387be Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 13 May 2024 16:56:45 +0200 Subject: [PATCH] Log errors as internal lines --- src/worker/run.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/worker/run.rs b/src/worker/run.rs index ea90372..5843463 100644 --- a/src/worker/run.rs +++ b/src/worker/run.rs @@ -58,6 +58,7 @@ impl RunInProgress { .rev() .cloned() .collect(); + UnfinishedRun { id: self.run.id.clone(), hash: self.run.hash.clone(), @@ -67,6 +68,10 @@ impl RunInProgress { } } + pub fn log_internal(&self, line: String) { + self.output.lock().unwrap().push((Source::Internal, line)); + } + pub fn log_stdout(&self, line: String) { self.output.lock().unwrap().push((Source::Stdout, line)); } @@ -76,6 +81,7 @@ impl RunInProgress { } pub async fn perform(&self, server: &Server) -> Option { + // TODO Log system info // TODO Handle aborts let result = match &self.run.bench_method { BenchMethod::Internal => self.perform_internal(server), @@ -87,8 +93,8 @@ impl RunInProgress { Ok(outcome) => outcome, Err(e) => { error!("Error during run for {}:\n{e:?}", server.name); - self.log_stderr("Internal error:".to_string()); - self.log_stderr(format!("{e:?}")); + self.log_internal("Internal error:".to_string()); + self.log_internal(format!("{e:?}")); Some(Finished { exit_code: -1, measurements: HashMap::new(),