From a4b178d1f1248b6309c40d72eb6c03d53864377b Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Thu, 4 Jun 2015 14:13:31 +1000 Subject: Fix hacking and requirements Change-Id: Ie7a36b0a7957f102b6a1195cdc7c0403cdd9545a --- turbo_hipster/cmd/analyse_historical.py | 9 ++++----- turbo_hipster/cmd/report_historical.py | 2 +- turbo_hipster/cmd/server.py | 3 +-- turbo_hipster/lib/models.py | 2 +- turbo_hipster/task_plugins/real_db_upgrade/handle_results.py | 2 +- turbo_hipster/worker_manager.py | 4 ++-- 6 files changed, 10 insertions(+), 12 deletions(-) (limited to 'turbo_hipster') diff --git a/turbo_hipster/cmd/analyse_historical.py b/turbo_hipster/cmd/analyse_historical.py index c76ed4f..a7ce33a 100644 --- a/turbo_hipster/cmd/analyse_historical.py +++ b/turbo_hipster/cmd/analyse_historical.py @@ -33,8 +33,7 @@ from turbo_hipster.task_plugins.real_db_upgrade import handle_results def main(): parser = argparse.ArgumentParser() parser.add_argument('-c', '--config', - default= - '/etc/turbo-hipster/config.yaml', + default='/etc/turbo-hipster/config.yaml', help='Path to yaml config file.') args = parser.parse_args() @@ -82,7 +81,7 @@ def main(): if cursor.rowcount == 0: for engine, dataset, migration in process( connection, swift_config['container'], item['name']): - if not 'duration' in migration: + if 'duration' not in migration: continue if migration['stats']: @@ -145,9 +144,9 @@ def process(connection, container, name): log.warn('Log %s contained no migrations' % name) for migration in lp.migrations: - if not 'start' in migration: + if 'start' not in migration: continue - if not 'end' in migration: + if 'end' not in migration: continue yield (engine_name, test_name, migration) diff --git a/turbo_hipster/cmd/report_historical.py b/turbo_hipster/cmd/report_historical.py index 35f3c9b..50e4a28 100644 --- a/turbo_hipster/cmd/report_historical.py +++ b/turbo_hipster/cmd/report_historical.py @@ -116,7 +116,7 @@ def process_dataset(dataset): math.ceil(recommend) # Innodb stats - if not migration in stats_summary: + if migration not in stats_summary: continue for stats_key in ['XInnodb_rows_changed', 'Innodb_rows_read']: diff --git a/turbo_hipster/cmd/server.py b/turbo_hipster/cmd/server.py index 30d8aaf..06f9415 100644 --- a/turbo_hipster/cmd/server.py +++ b/turbo_hipster/cmd/server.py @@ -65,8 +65,7 @@ def main(): os.path.join(os.path.dirname(__file__), '../'))) parser = argparse.ArgumentParser() parser.add_argument('-c', '--config', - default= - '/etc/turbo-hipster/config.yaml', + default='/etc/turbo-hipster/config.yaml', help='Path to yaml config file.') parser.add_argument('-b', '--background', action='store_true', help='Run as a daemon in the background.') diff --git a/turbo_hipster/lib/models.py b/turbo_hipster/lib/models.py index 1a2c836..b1cbbd2 100644 --- a/turbo_hipster/lib/models.py +++ b/turbo_hipster/lib/models.py @@ -48,7 +48,7 @@ class Task(object): self.log_handler.flush() self.log_handler.close() if ('shutdown-th' in self.job_config and - self.job_config['shutdown-th']): + self.job_config['shutdown-th']): self.worker_server.shutdown_gracefully() def _reset(self): diff --git a/turbo_hipster/task_plugins/real_db_upgrade/handle_results.py b/turbo_hipster/task_plugins/real_db_upgrade/handle_results.py index 198afe1..e701c5b 100644 --- a/turbo_hipster/task_plugins/real_db_upgrade/handle_results.py +++ b/turbo_hipster/task_plugins/real_db_upgrade/handle_results.py @@ -188,7 +188,7 @@ def check_log_file(log_file, git_path, dataset): migration.setdefault('stats', {}) # check migration completed - if not 'duration' in migration: + if 'duration' not in migration: success = False messages.append('WARNING - Migration %s->%s failed to complete' % (migration['from'], migration['to'])) diff --git a/turbo_hipster/worker_manager.py b/turbo_hipster/worker_manager.py index 40a1f35..a1cf47b 100644 --- a/turbo_hipster/worker_manager.py +++ b/turbo_hipster/worker_manager.py @@ -84,7 +84,7 @@ class ZuulManager(threading.Thread): self.log.debug("Waiting for server") self.gearman_worker.waitForServer() if (not self.stopped() and self.gearman_worker.running and - self.gearman_worker.active_connections): + self.gearman_worker.active_connections): self.register_functions() self.gearman_worker.waitForServer() logging.debug("Waiting for job") @@ -178,7 +178,7 @@ class ZuulClient(threading.Thread): self.log.debug("Waiting for server") self.gearman_worker.waitForServer() if (not self.stopped() and self.gearman_worker.running and - self.gearman_worker.active_connections): + self.gearman_worker.active_connections): self.register_functions() self.gearman_worker.waitForServer() self.log.debug("Waiting for job") -- cgit v1.2.1