diff options
author | Mark Wong | 2018-01-09 17:15:08 +0000 |
---|---|---|
committer | Mark Wong | 2018-01-30 22:22:33 +0000 |
commit | 2b128dc0cd92e215137729c3d7bfae73d6e0c7c5 (patch) | |
tree | 887b82a774f37c6f30ccd5409191fa49e095e165 | |
parent | 32c33f3aabfd4873cdfb0f4a6b8e93483493935c (diff) |
Set cwd when running pgbench
The output directory is used for the cwd when executing pgbench so that
the output files are saved in the results directory.
-rw-r--r-- | client/benchmarks/pgbench.py | 11 | ||||
-rwxr-xr-x | client/perffarm-client.py | 1 |
2 files changed, 8 insertions, 4 deletions
diff --git a/client/benchmarks/pgbench.py b/client/benchmarks/pgbench.py index bd6a0e6..d11d23c 100644 --- a/client/benchmarks/pgbench.py +++ b/client/benchmarks/pgbench.py @@ -16,19 +16,22 @@ class PgBench(object): # read-write/read-only tests # TODO allow running 'prepared' mode - def __init__(self, bin_path, dbname, runs=3, duration=60, csv=False): + def __init__(self, bin_path, dbname, runs=3, duration=60, csv=False, + results_dir=None): ''' bin_path - path to PostgreSQL binaries (dropdb, createdb, psql commands) dbname - name of the database to use - runs - number of runs (for each client count) duration - duration of each execution + runs - number of runs (for each client count) + out_dir - output directory ''' self._bin = bin_path self._csv = csv self._dbname = dbname self._duration = duration + self._outdir = results_dir self._runs = runs self._env = os.environ @@ -66,7 +69,7 @@ class PgBench(object): log("initializing pgbench '%s' with scale %s" % (self._dbname, scale)) r = run_cmd(['pgbench', '-i', '-s', str(scale), self._dbname], - env=self._env) + env=self._env, cwd=self._outdir) # remember the init duration self._results[scale]['init'] = r[2] @@ -171,7 +174,7 @@ class PgBench(object): "duration=%d" % (nclients, njobs, aggregate, read_only, duration)) start = time.time() - r = run_cmd(args, env=self._env) + r = run_cmd(args, env=self._env, cwd=self._outdir) end = time.time() r = PgBench._parse_results(r[1]) diff --git a/client/perffarm-client.py b/client/perffarm-client.py index 49a73aa..b04138d 100755 --- a/client/perffarm-client.py +++ b/client/perffarm-client.py @@ -52,6 +52,7 @@ if __name__ == '__main__': # register one config for each benchmark (should be moved to a config # file) + PGBENCH_CONFIG['results_dir'] = OUTPUT_DIR runner.register_config('pgbench-basic', 'pgbench', dbname=DATABASE_NAME, |