Skip to content

Commit

Permalink
add base path for finding logs
Browse files Browse the repository at this point in the history
CMK-16823
  • Loading branch information
SoloJacobs committed Apr 18, 2024
1 parent 372ee2a commit 3801c39
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
10 changes: 6 additions & 4 deletions src/bin/scheduler/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ fn run_build_command(
Ok(o) => o,
Err(e) => {
let log_error = e.context(anyhow!(
"Environment building failed, plan {id} will be dropped"
"Environment building failed, plan {id} will be dropped. See {} for stdio logs",
run_spec.base_path,
));
error!("{log_error:?}");
return Ok(BuildOutcome::Error(format!("{log_error:?}")));
Expand All @@ -115,9 +116,10 @@ fn run_build_command(
Ok(BuildOutcome::Success(duration))
} else {
error!("Environment building not successful, plan {id} will be dropped");
Ok(BuildOutcome::Error(
"Environment building not successful, see stdio logs".into(),
))
Ok(BuildOutcome::Error(format!(
"Environment building not successful, see {} for stdio logs",
run_spec.base_path
)))
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/bin/scheduler/setup/rcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,9 @@ fn execute_run_spec_in_session(
"{} for `{session}` exited non-successfully",
run_spec.command_spec
);
Ok(Some(
"Non-zero exit code, see stdio logs for details".into(),
))
Ok(Some(format!(
"Non-zero exit code, see {} for stdio logs",
run_spec.base_path
)))
}
}
2 changes: 1 addition & 1 deletion src/plans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub fn run_attempts_with_rebot(
plan_id: id,
environment,
session,
working_directory: output_directory,
base_path: output_directory.join("rebot"),
cancellation_token,
input_paths: &output_paths,
path_xml: &output_directory.join("rebot.xml"),
Expand Down
20 changes: 11 additions & 9 deletions src/rf/rebot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct Rebot<'a> {
pub plan_id: &'a str,
pub environment: &'a Environment,
pub session: &'a Session,
pub working_directory: &'a Utf8Path,
pub base_path: Utf8PathBuf,
pub cancellation_token: &'a CancellationToken,
pub input_paths: &'a [Utf8PathBuf],
pub path_xml: &'a Utf8Path,
Expand Down Expand Up @@ -55,16 +55,18 @@ impl Rebot<'_> {
Ok(self.process_successful_run(timestamp))
} else {
error!("Rebot run failed (no merged XML found)");
Ok(RebotOutcome::Error(
"Rebot run failed (no merged XML found), see stdio logs".into(),
))
Ok(RebotOutcome::Error(format!(
"Rebot run failed (no merged XML found), see {} for stdio logs",
self.base_path
)))
}
}
ResultCode::EnvironmentFailed => {
error!("Environment failure when running rebot");
Ok(RebotOutcome::Error(
"Environment failure when running rebot, see stdio logs".into(),
))
Ok(RebotOutcome::Error(format!(
"Environment failure when running rebot, see {} for stdio logs",
self.base_path,
)))
}
}
}
Expand All @@ -73,7 +75,7 @@ impl Rebot<'_> {
self.session.run(&RunSpec {
id: &format!("robotmk_rebot_{}", self.plan_id),
command_spec: &self.environment.wrap(self.build_rebot_command_spec()),
base_path: &self.working_directory.join("rebot"),
base_path: &self.base_path,
timeout: 120,
cancellation_token: self.cancellation_token,
})
Expand Down Expand Up @@ -140,7 +142,7 @@ mod tests {
&EnvironmentConfig::System,
),
session: &Session::Current(CurrentSession {}),
working_directory: &Utf8PathBuf::from("/working/my_plan"),
base_path: Utf8PathBuf::from("/working/my_plan/rebot"),
cancellation_token: &CancellationToken::default(),
input_paths: &[
Utf8PathBuf::from("/working/my_plan/0.xml"),
Expand Down

0 comments on commit 3801c39

Please sign in to comment.