Skip to content

Commit 79242c5

Browse files
authored
Merge pull request #8 from Raiduy/custom-num-runs-feature
Add multiple repetitions per run functionality.
2 parents d957a54 + 672172f commit 79242c5

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.idea
2+
.venv
23
*/__pycache__/*
34
examples/linux-ps-profiling/primer
45
examples/linux-powerjoular-profiling/primer

examples/hello-world/RunnerConfig.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def create_run_table_model(self) -> RunTableModel:
6161
{factor1: ['example_treatment1']}, # all runs having treatment "example_treatment1" will be excluded
6262
{factor1: ['example_treatment2'], factor2: [True]}, # all runs having the combination ("example_treatment2", True) will be excluded
6363
],
64+
repetitions = 3,
6465
data_columns=['avg_cpu', 'avg_mem']
6566
)
6667
return self.run_table_model

experiment-runner/ConfigValidator/Config/Models/RunTableModel.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class RunTableModel:
1212
def __init__(self,
1313
factors: List[FactorModel],
1414
exclude_variations: List[Dict[FactorModel, List[SupportsStr]]] = None,
15+
repetitions: int = 1,
1516
data_columns: List[str] = None,
1617
shuffle: bool = False
1718
):
@@ -20,6 +21,9 @@ def __init__(self,
2021
if data_columns is None:
2122
data_columns = []
2223

24+
if repetitions < 1:
25+
raise BaseError("Negative number of repetitions detected!")
26+
2327
if len(set([factor.factor_name for factor in factors])) != len(factors):
2428
raise BaseError("Duplicate factor name detected!")
2529

@@ -28,6 +32,7 @@ def __init__(self,
2832

2933
self.__factors = factors
3034
self.__exclude_variations = exclude_variations
35+
self.__repetitions = repetitions
3136
self.__data_columns = data_columns
3237
self.__shuffle = shuffle
3338

@@ -76,16 +81,18 @@ def __filter_list(full_list: List[Tuple]):
7681
column_names.append(data_column)
7782

7883
experiment_run_table = []
79-
for i, combo in enumerate(filtered_list):
80-
row_list = list(combo)
81-
row_list.insert(0, f'run_{i}') # __run_id
82-
row_list.insert(1, RunProgress.TODO) # __done
84+
for j in range(self.__repetitions):
85+
for i, combo in enumerate(filtered_list):
86+
row_list = list(combo)
87+
row_list.insert(0, f'run_{i}_repetition_{j}') # __run_id
88+
row_list.insert(1, RunProgress.TODO) # __done
8389

84-
if self.__data_columns:
85-
for _ in self.__data_columns:
86-
row_list.append(" ")
87-
experiment_run_table.append(dict(zip(column_names, row_list)))
90+
if self.__data_columns:
91+
for _ in self.__data_columns:
92+
row_list.append(" ")
93+
experiment_run_table.append(dict(zip(column_names, row_list)))
8894

8995
if self.__shuffle:
9096
random.shuffle(experiment_run_table)
9197
return experiment_run_table
98+

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
pandas
12
psutil
23
tabulate
34
dill

0 commit comments

Comments
 (0)