Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cli/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ impl RunArgs {
simulation_tool: None,
profile_folder: None,
skip_upload: false,
skip_polling: false,
skip_run: false,
skip_setup: false,
allow_empty: false,
Expand Down
10 changes: 10 additions & 0 deletions src/cli/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ pub struct ExecAndRunSharedArgs {
)]
pub skip_upload: bool,

/// Skips polling for the results after upload.
/// This is useful for local runs where the user doesn't want to wait for the results to be available on the server.
#[arg(
long,
default_value = "false",
hide = true,
env = "CODSPEED_SKIP_POLLING"
)]
pub skip_polling: bool,

/// Used internally to upload the results after running the benchmarks in a sandbox environment
/// with no internet access
#[arg(long, default_value = "false", hide = true)]
Expand Down
7 changes: 7 additions & 0 deletions src/executor/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub struct Config {

pub profile_folder: Option<PathBuf>,
pub skip_upload: bool,
pub skip_polling: bool,
pub skip_run: bool,
pub skip_setup: bool,
/// If true, allow execution even when no benchmarks are found
Expand Down Expand Up @@ -100,6 +101,7 @@ impl Config {
simulation_tool: SimulationTool::default(),
profile_folder: None,
skip_upload: false,
skip_polling: false,
skip_run: false,
skip_setup: false,
allow_empty: false,
Expand Down Expand Up @@ -139,6 +141,7 @@ impl TryFrom<RunArgs> for Config {
simulation_tool: args.shared.simulation_tool.unwrap_or_default(),
profile_folder: args.shared.profile_folder,
skip_upload: args.shared.skip_upload,
skip_polling: args.shared.skip_polling,
skip_run: args.shared.skip_run,
skip_setup: args.shared.skip_setup,
allow_empty: args.shared.allow_empty,
Expand Down Expand Up @@ -178,6 +181,7 @@ impl Config {
simulation_tool: args.shared.simulation_tool.unwrap_or_default(),
profile_folder: args.shared.profile_folder,
skip_upload: args.shared.skip_upload,
skip_polling: args.shared.skip_polling,
skip_run: args.shared.skip_run,
skip_setup: args.shared.skip_setup,
allow_empty: args.shared.allow_empty,
Expand Down Expand Up @@ -214,6 +218,7 @@ mod tests {
simulation_tool: None,
profile_folder: None,
skip_upload: false,
skip_polling: false,
skip_run: false,
skip_setup: false,
allow_empty: false,
Expand Down Expand Up @@ -254,6 +259,7 @@ mod tests {
simulation_tool: None,
profile_folder: Some("./codspeed.out".into()),
skip_upload: true,
skip_polling: true,
skip_run: true,
skip_setup: true,
allow_empty: true,
Expand Down Expand Up @@ -338,6 +344,7 @@ mod tests {
simulation_tool: None,
profile_folder: None,
skip_upload: false,
skip_polling: false,
skip_run: false,
skip_setup: false,
allow_empty: false,
Expand Down
4 changes: 4 additions & 0 deletions src/executor/execution_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ impl ExecutionContext {
self.provider.get_run_environment() == RunEnvironment::Local
}

pub fn should_poll_results(&self) -> bool {
self.is_local() && !self.config.skip_polling
}

pub async fn new(
mut config: Config,
codspeed_config: &CodSpeedConfig,
Expand Down
2 changes: 1 addition & 1 deletion src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ where
start_group!("Uploading results");
let upload_result = crate::upload::upload(execution_context, executor.name()).await?;

if execution_context.is_local() {
if execution_context.should_poll_results() {
poll_results(&upload_result).await?;
}
end_group!();
Expand Down
3 changes: 3 additions & 0 deletions src/project_config/merger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ mod tests {
simulation_tool: None,
profile_folder: None,
skip_upload: false,
skip_polling: false,
skip_run: false,
skip_setup: false,
allow_empty: false,
Expand Down Expand Up @@ -189,6 +190,7 @@ mod tests {
simulation_tool: None,
profile_folder: None,
skip_upload: false,
skip_polling: false,
skip_run: false,
skip_setup: false,
allow_empty: false,
Expand Down Expand Up @@ -224,6 +226,7 @@ mod tests {
simulation_tool: None,
profile_folder: None,
skip_upload: false,
skip_polling: false,
skip_run: false,
skip_setup: false,
allow_empty: false,
Expand Down