Skip to content

Commit

Permalink
sequential
Browse files Browse the repository at this point in the history
  • Loading branch information
VladasZ committed Oct 17, 2023
1 parent 104a971 commit a1d6714
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
17 changes: 8 additions & 9 deletions integration-tests/src/measure/measure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use itertools::Itertools;
use tokio::spawn;
use workspaces::types::Gas;

use crate::measure::utils::measure_chunk_size;
use crate::{measure::register_product::measure_register_product, product::RegisterProductCommand};

#[ignore]
Expand All @@ -33,16 +32,16 @@ where
let inputs = inputs.into_iter().collect_vec();

// async concurrent execution
let all = inputs.iter().map(|inp| command(*inp)).collect_vec();

let res: Vec<_> = join_all(all).await.into_iter().collect::<anyhow::Result<_>>()?;
// let all = inputs.iter().map(|inp| command(*inp)).collect_vec();
//
// let res: Vec<_> = join_all(all).await.into_iter().collect::<anyhow::Result<_>>()?;

// sequential execution
// let mut res = vec![];
//
// for input in &inputs {
// res.push(command(*input).await?);
// }
let mut res = vec![];

for input in &inputs {
res.push(command(*input).await?);
}

// Too many concurrent jobs may overwhelm workspaces test framework
// let chunks = inputs.iter().map(|inp| command(*inp)).chunks(measure_chunk_size());
Expand Down
10 changes: 7 additions & 3 deletions integration-tests/src/measure/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ use workspaces::{types::Gas, Account};
use crate::{context::Context, product::RegisterProductCommand};

pub fn number_of_jars_to_measure() -> usize {
var("MEASURE_JARS_COUNT").map(|val| val.parse().unwrap()).unwrap_or(20)
var("MEASURE_JARS_COUNT")
.map(|val| val.parse().unwrap_or(20))
.unwrap_or(20)
}

pub fn measure_chunk_size() -> usize {
var("MEASURE_CHUNK_SIZE").map(|val| val.parse().unwrap()).unwrap_or(5)
pub fn _measure_chunk_size() -> usize {
var("MEASURE_CHUNK_SIZE")
.map(|val| val.parse().unwrap_or(5))
.unwrap_or(5)
}

#[derive(Serialize)]
Expand Down
2 changes: 1 addition & 1 deletion scripts/measure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -eox pipefail

if [ -z ${MEASURE_JARS_COUNT+x} ]; then echo "MEASURE_JARS_COUNT is unset"; else echo "MEASURE_JARS_COUNT is set to '$MEASURE_JARS_COUNT'"; fi
if [ -z ${MEASURE_CHUNK_SIZE+x} ]; then echo "MEASURE_CHUNK_SIZE is unset"; else echo "MEASURE_CHUNK_SIZE is set to 'MEASURE_CHUNK_SIZE'"; fi
if [ -z ${MEASURE_CHUNK_SIZE+x} ]; then echo "MEASURE_CHUNK_SIZE is unset"; else echo "MEASURE_CHUNK_SIZE is set to '$MEASURE_CHUNK_SIZE'"; fi


rm -f measured.txt
Expand Down

0 comments on commit a1d6714

Please sign in to comment.