Skip to content

Commit

Permalink
RCC setup: Factor out fct. for running command once in current session
Browse files Browse the repository at this point in the history
This is a step towards enabling support for long paths.

CMK-15211
  • Loading branch information
jherbel committed Nov 17, 2023
1 parent 315065c commit 06b5410
Showing 1 changed file with 38 additions and 33 deletions.
71 changes: 38 additions & 33 deletions v2/robotmk/src/bin/scheduler/setup/rcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn rcc_setup(global_config: &GlobalConfig, rcc_suites: Vec<Suite>) -> Result<Vec
failed_suites.into_iter().map(|suite| suite.name).collect();
if !rcc_setup_failures.telemetry_disabling.is_empty() {
error!(
"Dropping the following suites due RCC telemetry disabling failure: {}",
"Dropping the following suites due to RCC telemetry disabling failure: {}",
rcc_setup_failures.telemetry_disabling.join(", ")
);
}
Expand Down Expand Up @@ -115,46 +115,27 @@ fn disable_rcc_telemetry(
"--do-not-track".into(),
],
},
"rcc_telemetry_disabling",
"telemetry_disabling",
)
}

fn shared_holotree_init(
global_config: &GlobalConfig,
suites: Vec<Suite>,
) -> Result<(Vec<Suite>, Vec<Suite>)> {
Ok(
if run_command_spec_in_session(
&Session::Current(CurrentSession {}),
&RunSpec {
id: "rcc_shared_holotree_init",
command_spec: &CommandSpec {
executable: global_config.rcc_binary_path.to_string(),
arguments: vec![
"holotree".into(),
"shared".into(),
"--enable".into(),
"--once".into(),
],
},
base_path: &rcc_setup_working_directory(&global_config.working_directory)
.join("shared_holotree_init"),
timeout: 120,
termination_flag: &global_config.termination_flag,
},
)? {
(suites, vec![])
} else {
error!(
"Shared holotree initialization failed for the following suites which will now be dropped: {}",
suites
.iter()
.map(|suite| suite.name.as_str())
.collect::<Vec<&str>>()
.join(", ")
);
(vec![], suites)
run_command_spec_once_in_current_session(
global_config,
suites,
&CommandSpec {
executable: global_config.rcc_binary_path.to_string(),
arguments: vec![
"holotree".into(),
"shared".into(),
"--enable".into(),
"--once".into(),
],
},
"shared_holotree_init",
)
}

Expand All @@ -173,6 +154,30 @@ fn holotree_init(
)
}

fn run_command_spec_once_in_current_session(
global_config: &GlobalConfig,
suites: Vec<Suite>,
command_spec: &CommandSpec,
id: &str,
) -> Result<(Vec<Suite>, Vec<Suite>)> {
Ok(
if run_command_spec_in_session(
&Session::Current(CurrentSession {}),
&RunSpec {
id: &format!("robotmk_{id}"),
command_spec,
base_path: &rcc_setup_working_directory(&global_config.working_directory).join(id),
timeout: 120,
termination_flag: &global_config.termination_flag,
},
)? {
(suites, vec![])
} else {
(vec![], suites)
},
)
}

fn run_command_spec_per_session(
global_config: &GlobalConfig,
suites: Vec<Suite>,
Expand Down

0 comments on commit 06b5410

Please sign in to comment.