MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / run_executor

Function run_executor

src/executor/mod.rs:156–226  ·  view source on GitHub ↗

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>,
    rolling_buffer_label: Option<&str>,
)

Source from the content-addressed store, hash-verified

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

Callers 1

executeMethod · 0.85

Calls 12

install_mongodb_tracerFunction · 0.85
activate_rolling_bufferFunction · 0.85
is_mongodb_enabledMethod · 0.80
startMethod · 0.80
stopMethod · 0.80
support_levelMethod · 0.45
setupMethod · 0.45
grant_privilegesMethod · 0.45
runMethod · 0.45
teardownMethod · 0.45

Tested by

no test coverage detected