diff --git a/vbench/git.py b/vbench/git.py index 2f0a26b..92b3adf 100644 --- a/vbench/git.py +++ b/vbench/git.py @@ -172,7 +172,7 @@ def _copy_benchmark_scripts_and_deps(self): deps.extend(self.dependencies) for dep in deps: - cmd = 'cp %s %s' % (dep, self.target_dir) + cmd = 'cp -R %s %s' % (dep, self.target_dir) print cmd proc = subprocess.Popen(cmd, shell=True) proc.wait() diff --git a/vbench/runner.py b/vbench/runner.py index 82a85f1..b50cb8c 100644 --- a/vbench/runner.py +++ b/vbench/runner.py @@ -25,6 +25,8 @@ class BenchmarkRunner(object): overwrite : boolean dependencies : list or None should be list of modules visible in cwd + time : boolean + whether to measure how much running the benchmarks takes """ def __init__(self, benchmarks, repo_path, repo_url, @@ -33,7 +35,8 @@ def __init__(self, benchmarks, repo_path, repo_url, run_option='eod', start_date=None, overwrite=False, module_dependencies=None, always_clean=False, - use_blacklist=True): + use_blacklist=True, + time=True): self.benchmarks = benchmarks self.checksums = [b.checksum for b in benchmarks] @@ -50,7 +53,7 @@ def __init__(self, benchmarks, repo_path, repo_url, self.use_blacklist = use_blacklist self.blacklist = set(self.db.get_rev_blacklist()) - + self.time = time # where to copy the repo self.tmp_dir = tmp_dir self.bench_repo = BenchRepo(repo_url, self.tmp_dir, build_cmd, @@ -58,6 +61,7 @@ def __init__(self, benchmarks, repo_path, repo_url, always_clean=always_clean, dependencies=module_dependencies) self._register_benchmarks() + self._python = os.environ.get('VBENCH_PYTHON', 'python') def run(self): revisions = self._get_revisions_to_run() @@ -134,8 +138,10 @@ def _run_revision(self, rev): pickle.dump(need_to_run, open(pickle_path, 'w')) # run the process - cmd = 'python vb_run_benchmarks.py %s %s' % (pickle_path, results_path) - print cmd + cmd = '%s vb_run_benchmarks.py %s %s' % (self._python, pickle_path, + results_path) + if self.time: + cmd = 'time ' + cmd proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, diff --git a/vbench/scripts/vb_run_benchmarks.py b/vbench/scripts/vb_run_benchmarks.py index 2faff70..1f2febb 100644 --- a/vbench/scripts/vb_run_benchmarks.py +++ b/vbench/scripts/vb_run_benchmarks.py @@ -1,4 +1,5 @@ import sys +import traceback import cPickle as pickle if len(sys.argv) != 3: @@ -12,8 +13,10 @@ for bmk in benchmarks: try: res = bmk.run() + results[bmk.checksum] = res except Exception: + print >> sys.stderr, 'Exception in benchmark %s:' % bmk.name + traceback.print_exc() continue - results[bmk.checksum] = res benchmarks = pickle.dump(results, open(out_path, 'w'))