diff options
author | Mark Wong | 2018-07-18 00:10:17 +0000 |
---|---|---|
committer | Mark Wong | 2018-07-18 00:10:17 +0000 |
commit | 611e28c6a76b0c43def17fc2cefffbe2c4ea2357 (patch) | |
tree | 89d0a13be617d171bac5b99dcdfd59d1627aa3ff | |
parent | db094c62bbdd024127a399547f62c7ecda073bfd (diff) |
Save postgres branch, commit, and settings in results json
-rw-r--r-- | client/benchmarks/runner.py | 14 | ||||
-rwxr-xr-x | client/perffarm-client.py | 2 | ||||
-rw-r--r-- | client/utils/git.py | 10 |
3 files changed, 23 insertions, 3 deletions
diff --git a/client/benchmarks/runner.py b/client/benchmarks/runner.py index 4d56187..a0532e2 100644 --- a/client/benchmarks/runner.py +++ b/client/benchmarks/runner.py @@ -26,15 +26,17 @@ class BenchmarkRunner(object): # FIXME check if a mapping for the same name already exists self._benchmarks.update({benchmark_name: benchmark_class}) - def register_config(self, config_name, benchmark_name, postgres_config, - **kwargs): + def register_config(self, config_name, benchmark_name, branch, commit, + postgres_config, **kwargs): '' # FIXME check if a mapping for the same name already exists # FIXME check that the benchmark mapping already exists self._configs.update({config_name: {'benchmark': benchmark_name, 'config': kwargs, - 'postgres': postgres_config}}) + 'postgres': postgres_config, + 'branch': branch, + 'commit': commit}}) def _check_config(self, config_name): '' @@ -114,6 +116,12 @@ class BenchmarkRunner(object): 'uname': uname, } + r['postgres'] = { + 'branch': config['branch'], + 'commit': config['commit'], + 'settings': config['postgres'], + } + with open('%s/results.json' % self._output, 'w') as f: f.write(json.dumps(r, indent=4)) diff --git a/client/perffarm-client.py b/client/perffarm-client.py index 0b0c0d3..48a1916 100755 --- a/client/perffarm-client.py +++ b/client/perffarm-client.py @@ -66,6 +66,8 @@ if __name__ == '__main__': PGBENCH_CONFIG['results_dir'] = OUTPUT_DIR runner.register_config('pgbench-basic', 'pgbench', + repository.current_branch(), + repository.current_commit(), dbname=DATABASE_NAME, bin_path=('%s/bin' % (BUILD_PATH,)), postgres_config=POSTGRES_CONFIG, diff --git a/client/utils/git.py b/client/utils/git.py index d380d7f..abef886 100644 --- a/client/utils/git.py +++ b/client/utils/git.py @@ -40,6 +40,15 @@ class GitRepository(object): with TemporaryFile() as strout: call(['git', 'pull'], cwd=self._path, stdout=strout, stderr=STDOUT) + def current_branch(self): + 'returns current branch' + + with TemporaryFile() as strout: + call(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], cwd=self._path, + stdout=strout, stderr=STDOUT) + strout.seek(0) + return strout.read().strip() + def current_commit(self): 'returns current commit hash' @@ -57,6 +66,7 @@ class GitRepository(object): else: self._clone() + log("current branch '%s'" % (self.current_branch(),)) log("current commit '%s'" % (self.current_commit(),)) def build_and_install(self, path, remove=True): |