From c9a0b1a201e7f634cd61c8fcca3472a5f03d355e Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Tue, 7 May 2024 12:23:36 +0200 Subject: [PATCH] Add precommands to workloads --- xtask/src/bench/workload.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xtask/src/bench/workload.rs b/xtask/src/bench/workload.rs index d82c5ad19..db44b5a8f 100644 --- a/xtask/src/bench/workload.rs +++ b/xtask/src/bench/workload.rs @@ -22,6 +22,8 @@ pub struct Workload { pub run_count: u16, pub extra_cli_args: Vec, pub assets: BTreeMap, + #[serde(default)] + pub precommands: Vec, pub commands: Vec, } @@ -37,6 +39,15 @@ async fn run_commands( let report_folder = &args.report_folder; let workload_name = &workload.name; + for batch in workload + .precommands + .as_slice() + .split_inclusive(|command| !matches!(command.synchronous, SyncMode::DontWait)) + { + super::command::run_batch(meili_client, batch, &workload.assets, &args.asset_folder) + .await?; + } + std::fs::create_dir_all(report_folder) .with_context(|| format!("could not create report directory at {report_folder}"))?;