Run a single executor: setup → run → teardown → persist logs. Does NOT upload.
(
executor: &mut dyn Executor,
orchestrator: &Orchestrator,
execution_context: &ExecutionContext,
setup_cache_dir: Option<&Path>,
display_label: Option<&str>,
)
| 159 | /// Run a single executor: setup → run → teardown → persist logs. |
| 160 | /// Does NOT upload. |
| 161 | pub async fn run_executor( |
| 162 | executor: &mut dyn Executor, |
| 163 | orchestrator: &Orchestrator, |
| 164 | execution_context: &ExecutionContext, |
| 165 | setup_cache_dir: Option<&Path>, |
| 166 | display_label: Option<&str>, |
| 167 | ) -> Result<()> { |
| 168 | let run_environment = orchestrator.provider.get_run_environment(); |
| 169 | match executor.support_level(&orchestrator.system_info) { |
| 170 | ExecutorSupport::Unsupported => { |
| 171 | bail!( |
| 172 | "The {} executor is not supported on {}", |
| 173 | executor.name(), |
| 174 | orchestrator.system_info.os |
| 175 | ); |
| 176 | } |
| 177 | ExecutorSupport::RequiresManualInstallation | ExecutorSupport::FullySupported => { |
| 178 | if !execution_context.config.skip_setup { |
| 179 | executor |
| 180 | .setup(&orchestrator.system_info, setup_cache_dir, &run_environment) |
| 181 | .await?; |
| 182 | executor.grant_privileges()?; |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | if !execution_context.config.skip_setup { |
| 188 | // TODO: refactor and move directly in the Instruments struct as a `setup` method |
| 189 | if execution_context.config.instruments.is_mongodb_enabled() { |
| 190 | install_mongodb_tracer().await?; |
| 191 | } |
| 192 | |
| 193 | debug!("Environment ready"); |
| 194 | } |
| 195 | |
| 196 | if !execution_context.config.skip_run { |
| 197 | // TODO: refactor and move directly in the Instruments struct as a `start` method |
| 198 | let mongo_tracer = |
| 199 | if let Some(mongodb_config) = &execution_context.config.instruments.mongodb { |
| 200 | let mut mongo_tracer = |
| 201 | MongoTracer::try_from(&execution_context.profile_folder, mongodb_config)?; |
| 202 | mongo_tracer.start().await?; |
| 203 | Some(mongo_tracer) |
| 204 | } else { |
| 205 | None |
| 206 | }; |
| 207 | |
| 208 | let display_guard = |
| 209 | display_label.and_then(|label| run_environment.start_command_display(label)); |
| 210 | let run_result = executor.run(execution_context, &mongo_tracer).await; |
| 211 | if let Some(guard) = display_guard { |
| 212 | guard.finish_with(run_result.is_ok()); |
| 213 | } |
| 214 | run_result?; |
| 215 | |
| 216 | // TODO: refactor and move directly in the Instruments struct as a `stop` method |
| 217 | if let Some(mut mongo_tracer) = mongo_tracer { |
| 218 | mongo_tracer.stop().await?; |
no test coverage detected