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

Method execute

src/executor/orchestrator.rs:69–175  ·  view source on GitHub ↗

Execute all benchmark targets for all configured modes, then upload results. Flattens all `(command, mode)` pairs into a single iteration: - All `Exec` targets are combined into a single exec-harness command - Each `Entrypoint` target produces its own command - Each command is crossed with every configured mode Each `(command, mode)` pair gets its own profile folder. When the user specifies `--p

(
        &self,
        setup_cache_dir: Option<&Path>,
        api_client: &mut CodSpeedAPIClient,
    )

Source from the content-addressed store, hash-verified

67 /// specifies `--profile-folder` and there are multiple pairs, deterministic
68 /// subdirectories (`<mode>-<index>`) are created under that folder.
69 pub async fn execute(
70 &self,
71 setup_cache_dir: Option<&Path>,
72 api_client: &mut CodSpeedAPIClient,
73 ) -> Result<()> {
74 // Build (command, label, uses_exec_harness) tuples while we still know the target type
75 let mut command_labels: Vec<(String, String, bool)> = vec![];
76
77 let exec_targets: Vec<&BenchmarkTarget> = self
78 .config
79 .targets
80 .iter()
81 .filter(|t| matches!(t, BenchmarkTarget::Exec { .. }))
82 .collect();
83
84 if !exec_targets.is_empty() {
85 ensure_binary_installed(
86 EXEC_HARNESS_COMMAND,
87 EXEC_HARNESS_VERSION,
88 PinnedBinary::ExecHarnessInstaller,
89 )
90 .await?;
91
92 let pipe_cmd = multi_targets::build_exec_targets_pipe_command(&exec_targets)?;
93 let label = match exec_targets.as_slice() {
94 [BenchmarkTarget::Exec { command, .. }] => {
95 format!("Running `{}` with exec-harness", command.join(" "))
96 }
97 targets => format!("Running {} commands with exec-harness", targets.len()),
98 };
99 command_labels.push((pipe_cmd, label, true));
100 }
101
102 for target in &self.config.targets {
103 if let BenchmarkTarget::Entrypoint { command, .. } = target {
104 command_labels.push((command.clone(), command.clone(), false));
105 }
106 }
107
108 struct ExecutorTarget<'a> {
109 command: String,
110 mode: &'a RunnerMode,
111 label: String,
112 uses_exec_harness: bool,
113 }
114
115 // Flatten into (command, mode) run parts
116 let modes = &self.config.modes;
117 let run_parts: Vec<ExecutorTarget> = command_labels
118 .iter()
119 .flat_map(|(cmd, label, uses_exec_harness)| {
120 modes.iter().map(move |mode| {
121 let executor_name = get_executor_from_mode(mode, None).name();
122 ExecutorTarget {
123 command: cmd.clone(),
124 mode,
125 label: format!(
126 "{} {} - {label}",

Callers 2

execute_configFunction · 0.80
runFunction · 0.80

Calls 10

ensure_binary_installedFunction · 0.85
get_executor_from_modeFunction · 0.85
run_executorFunction · 0.85
as_strMethod · 0.80
upload_and_pollMethod · 0.80
is_emptyMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected