Skip to content
Snippets Groups Projects
Commit 01ac3c41 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

variants: factor the code to gather dimensions in the benchmarks class

This will help use to make this generic as we introduce more variants.
parent 04aef913
No related branches found
No related tags found
1 merge request!12runner: factor out some part of the benchmark class
......@@ -36,11 +36,7 @@
def __init__(self, data, variants=None):
super().__init__(data, variants)
l_1 = self._data.get('simple-command', {})
l_2 = l_1.get('variants', {})
all_dimensions = l_2.get('dimensions', {})
for dimension, variants in all_dimensions.items():
for dimension, variants in self.all_dimensions.items():
# find the variants we should use.
selected = self._selected_variants.get(dimension)
if selected is None:
......@@ -61,6 +57,13 @@
if extend_command is not None:
self._data['simple-command']['command'] += extend_command
@property
def all_dimensions(self):
l_1 = self._data.get('simple-command', {})
l_2 = l_1.get('variants', {})
all_dimensions = l_2.get('dimensions', {})
return all_dimensions.copy()
def get_benchmark(path_def):
"""get a benchmark from path applying possible variant selection on the way
......
......@@ -14,6 +14,7 @@
sys.path.insert(0, os.path.join(poulpe_root, 'python-libs'))
import poulpe
from poulpe import runner as runner_lib
TARGET_PYTHON_VERSIONS = [
"3.7"
......@@ -123,7 +124,5 @@
all_files = [Path(*p.parts[prefix:]) for p in bench_dir.rglob("*.pbd")]
all_benchmarks = []
for f in all_files:
data = poulpe.get_data(bench_dir / f)
l_1 = data.get('simple-command', {})
l_2 = l_1.get('variants', {})
benchmark = runner_lib.get_benchmark(bench_dir / f)
all_dimensions = []
......@@ -129,5 +128,5 @@
all_dimensions = []
for d, v in l_2.get('dimensions', {}).items():
for d, v in benchmark.all_dimensions.items():
all_dimensions.append([f'{d}={k}' for k in list(v.keys())])
if not all_dimensions:
all_benchmarks.append(f)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment