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

runner: copy the data-env when necessary

parent 77a63957
No related branches found
No related tags found
No related merge requests found
import pathlib
import time
......@@ -1,4 +2,5 @@
import time
import shutil
from . import (
basics as poulpe,
......@@ -12,6 +14,16 @@
RETURN_CODE_SETUP_ISSUE = 64
def copy_data_env(reference, tmp):
cleanup_data_env(tmp) # remove potential remains of previous runs
shutil.copytree(reference, tmp) # we need to preserver stuff
def cleanup_data_env(tmp_data):
if tmp_data is not None:
shutil.rmtree(tmp_data, ignore_errors=True)
def run_one_core(bin_env_path, data_env_path, benchmark_path):
result_data = {}
result_data['run'] = {}
......@@ -32,6 +44,13 @@
bin_env_data = poulpe.get_data(bin_env_desc)
result_data['bin-env-vars'] = bin_env_data['bin-env-vars']
tmp_data = None
if benchmark.get_var('run.copy-data-env', True):
data_env_path = pathlib.Path(data_env_path)
tmp_data = data_env_path.parent / f"TMP-{data_env_path.name}"
copy_data_env(data_env_path, tmp_data)
data_env_path = tmp_data
# gather info about the data environment
data_env_data = data_mod.get_data_env(data_env_path)
result_data['data-env-vars'] = data_env_data.data_env_vars
......@@ -40,6 +59,7 @@
bench_result = benchmark.run_one(bin_env_path, data_env_path)
result_data['result'] = bench_result
finally:
cleanup_data_env(tmp_data)
duration = time.time() - result_data['run']["timestamp"]
result_data['run']["duration"] = duration
return result_data
......
......@@ -3,6 +3,9 @@
name="perf-bundle"
method="mercurial-perf-extension"
[run]
run.copy-data-env = false
[hg-perf-ext]
command="perf::bundle"
cwd="DATA-VARS:mercurial.main-repo-path"
......
......@@ -3,6 +3,9 @@
name="perf-startup"
method="mercurial-perf-extension"
[run]
run.copy-data-env = false
[hg-perf-ext]
command="perf::startup"
cwd="DATA-VARS:mercurial.main-repo-path"
......@@ -3,6 +3,9 @@
name = "mercurial.status.mardu-plain-large"
method = "simple-command"
[run]
run.copy-data-env = false
[simple-command]
command = "hg status"
......
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