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

runner: split the `run_one` function

Let split the actual running from the more shell oriented part.
parent e5db5ad5
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@
RETURN_CODE_SETUP_ISSUE = 64
def run_one(bin_env_path, data_env_path, benchmark_path, result):
def run_one_core(bin_env_path, data_env_path, benchmark_path):
result_data = {}
result_data['run'] = {}
result_data['run']["timestamp"] = time.time()
......@@ -37,6 +37,20 @@
try:
bench_result = benchmark.run_one(bin_env_path, data_env_path)
result_data['result'] = bench_result
finally:
duration = time.time() - result_data['run']["timestamp"]
result_data['run']["duration"] = duration
return result_data
def run_one(bin_env_path, data_env_path, benchmark_path, result):
try:
result_data = run_one_core(
bin_env_path,
data_env_path,
benchmark_path,
)
except errors.MissingDataEnvInputVars as exc:
err = poulpe.err
msg = (
......@@ -45,7 +59,6 @@
)
err(msg)
return RETURN_CODE_SETUP_ISSUE
except errors.BenchmarkRunFailure as exc:
err = poulpe.err
err("ERROR: running benchmark failed:")
......@@ -69,11 +82,6 @@
for line in exc.stderr.splitlines():
err(f"ERROR: {line.decode('utf8')}")
return RETURN_CODE_EXEC_ISSUE
result_data['result'] = bench_result
duration = time.time() - result_data['run']["timestamp"]
result_data['run']["duration"] = duration
poulpe.write_data(result, result_data)
return RETURN_CODE_SUCCESS
else:
poulpe.write_data(result, result_data)
return RETURN_CODE_SUCCESS
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