From: Mark Wong Date: Sat, 3 Feb 2018 22:15:19 +0000 (-0800) Subject: Move results directory check to start of client X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=015daacf6a8b53a682b989888ae7b75ddc82ccd8;p=pgperffarm.git Move results directory check to start of client Between the benchmark and collector modules, it's not clear who might have created the output directory first. Leave a warning in the benchmark modules for now, otherwise don't let it prevent the tests from running. --- diff --git a/client/benchmarks/runner.py b/client/benchmarks/runner.py index 41a3d7e..4d56187 100644 --- a/client/benchmarks/runner.py +++ b/client/benchmarks/runner.py @@ -56,10 +56,6 @@ class BenchmarkRunner(object): issues = {} - if os.path.exists(self._output): - issues['global'] = ["output directory '%s' already exists" % - (self._output,)] - for config_name in self._configs: t = self._check_config(config_name) if t: @@ -124,7 +120,12 @@ class BenchmarkRunner(object): def run(self): 'run all the configured benchmarks' - os.mkdir(self._output) + # It's ok if the output directory already exists. One of the other + # collector modules may have started before the benchmark. + try: + os.mkdir(self._output) + except OSError as e: + log("WARNING: output directory already exists: %s" % self._output) for config_name in self._configs: self._run_config(config_name) diff --git a/client/perffarm-client.py b/client/perffarm-client.py index 90810e6..035bf7d 100755 --- a/client/perffarm-client.py +++ b/client/perffarm-client.py @@ -20,6 +20,10 @@ from settings import * if __name__ == '__main__': + if os.path.exists(OUTPUT_DIR): + print "output directory '%s' already exists" % OUTPUT_DIR + sys.exit(1) + with FileLock('.lock') as lock: # clone repository and build the sources