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

runner: abstract the running of the command out

We are now ready to introduce a new way to run benchmarks \o/.
parent e813d132
No related branches found
No related tags found
1 merge request!12runner: factor out some part of the benchmark class
Pipeline #56157 passed
......@@ -64,6 +64,23 @@
all_dimensions = l_2.get('dimensions', {})
return all_dimensions.copy()
def run_one(self, bin_env_path, data_env_path):
data_env_desc = poulpe.data_env_file(data_env_path)
data_env_data = poulpe.get_data(data_env_desc)
cmd = SimpleCommand(self)
cmd.apply_data_env(data_env_data)
r = _time_command(bin_env_path, data_env_path, cmd)
res = {}
# we should store more
res['time'] = {}
res['time']['median'] = r['results'][0]['median']
res['time']['mean'] = r['results'][0]['mean']
res['time']['standard-deviation'] = r['results'][0]['stddev']
res['time']['min'] = r['results'][0]['min']
res['time']['max'] = r['results'][0]['max']
return res
def get_benchmark(path_def):
"""get a benchmark from path applying possible variant selection on the way
......@@ -85,6 +102,8 @@
class SimpleCommand(object):
# XXX should probably be merged back (or rebalanced) with the
# SimpleCommandBenchmark class
def __init__(self, benchmark_data):
self._benchmark_data = benchmark_data
......@@ -142,9 +161,10 @@
benchmark = get_benchmark(benchmark_path)
assert benchmark is not None, benchmark_path
result_data['benchmark'] = {}
result_data['benchmark']['name'] = benchmark.name
variants = benchmark.selected_variants
if variants:
result_data['benchmark']['variants'] = variants
......@@ -145,13 +165,8 @@
result_data['benchmark'] = {}
result_data['benchmark']['name'] = benchmark.name
variants = benchmark.selected_variants
if variants:
result_data['benchmark']['variants'] = variants
# building the benchmark scenarion, that will likely changes often and quickly
cmd = SimpleCommand(benchmark)
cmd.apply_data_env(data_env_data)
r = _time_command(bin_env_path, data_env_path, cmd)
bench_result = benchmark.run_one(bin_env_path, data_env_path)
......@@ -157,10 +172,3 @@
# we should store more
result_data['result'] = {}
result_data['result']['time'] = {}
result_data['result']['time']['median'] = r['results'][0]['median']
result_data['result']['time']['mean'] = r['results'][0]['mean']
result_data['result']['time']['standard-deviation'] = r['results'][0]['stddev']
result_data['result']['time']['min'] = r['results'][0]['min']
result_data['result']['time']['max'] = r['results'][0]['max']
result_data['result'] = bench_result
......@@ -166,5 +174,6 @@
result_data['run']["duration"] = time.time() - result_data['run']["timestamp"]
duration = time.time() - result_data['run']["timestamp"]
result_data['run']["duration"] = duration
poulpe.write_data(result, result_data)
return 0
......
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