From 0c1d0c6f3390b76b0aba3977243d5a38a21f78f6 Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Tue, 24 Sep 2013 22:33:18 +1000 Subject: [PATCH] Fix log dest dir path --- turbo_hipster/lib/utils.py | 12 ++++++------ .../gate_real_db_upgrade/handle_results.py | 3 +-- .../task_plugins/gate_real_db_upgrade/task.py | 8 ++++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/turbo_hipster/lib/utils.py b/turbo_hipster/lib/utils.py index 50f2a63..eda0c0a 100644 --- a/turbo_hipster/lib/utils.py +++ b/turbo_hipster/lib/utils.py @@ -186,17 +186,17 @@ def execute_to_log(cmd, logfile, timeout=-1, log_hanlder.close() -def push_file(dest_dir, file_path, publish_config): +def push_file(job_log_dir, file_path, publish_config): """ Push a log file to a server. Returns the public URL """ method = publish_config['type'] + '_push_file' if method in globals() and hasattr(globals()[method], '__call__'): return globals()[method](dest_dir, file_path, publish_config) -def swift_push_file(dest_dir, file_path, swift_config): +def swift_push_file(job_log_dir, file_path, swift_config): """ Push a log file to a swift server. """ with open(file_path, 'r') as fd: - name = dest_dir + '_' + os.path.basename(file_path) + name = job_log_dir + '_' + os.path.basename(file_path) con = swiftclient.client.Connection(swift_config['authurl'], swift_config['user'], swift_config['apikey']) @@ -204,9 +204,9 @@ def swift_push_file(dest_dir, file_path, swift_config): return obj -def local_push_file(dest_dir, file_path, local_config): +def local_push_file(job_log_dir, file_path, local_config): """ Copy the file locally somewhere sensible """ - dest_dir = os.path.join(local_config['path'], dest_dir) + dest_dir = os.path.join(local_config['path'], job_log_dir) dest_filename = os.path.basename(file_path) if not os.path.isdir(dest_dir): os.makedirs(dest_dir) @@ -217,7 +217,7 @@ def local_push_file(dest_dir, file_path, local_config): return local_config['prepend_url'] + os.path.join(dest_dir, dest_filename) -def scp_push_file(dest_dir, file_path, local_config): +def scp_push_file(job_log_dir, file_path, local_config): """ Copy the file remotely over ssh """ pass diff --git a/turbo_hipster/task_plugins/gate_real_db_upgrade/handle_results.py b/turbo_hipster/task_plugins/gate_real_db_upgrade/handle_results.py index 5eac355..791ac18 100644 --- a/turbo_hipster/task_plugins/gate_real_db_upgrade/handle_results.py +++ b/turbo_hipster/task_plugins/gate_real_db_upgrade/handle_results.py @@ -56,8 +56,7 @@ def generate_push_results(datasets, publish_config): """ Generates and pushes results """ for i, dataset in enumerate(datasets): - result_uri = push_file(dataset['determined_path'], - dataset['log_file_path'], + result_uri = push_file(dataset['job_log_file_path'], publish_config) datasets[i]['result_uri'] = result_uri diff --git a/turbo_hipster/task_plugins/gate_real_db_upgrade/task.py b/turbo_hipster/task_plugins/gate_real_db_upgrade/task.py index bc95ea1..d1dd283 100644 --- a/turbo_hipster/task_plugins/gate_real_db_upgrade/task.py +++ b/turbo_hipster/task_plugins/gate_real_db_upgrade/task.py @@ -169,8 +169,8 @@ class Runner(threading.Thread): for i, dataset in enumerate(self.job_datasets): # Look for the beginning of the migration start dataset_success, message = \ - handle_results.check_log_for_errors(dataset['log_file_path'], - self.git_path) + handle_results.check_log_for_errors( + dataset['job_log_file_path'], self.git_path) self.job_datasets[i]['result'] = message success = False if not dataset_success else success @@ -217,7 +217,7 @@ class Runner(threading.Thread): self.job_arguments, self.plugin_config['job'], self.job.unique ) - dataset['log_file_path'] = os.path.join( + dataset['job_log_file_path'] = os.path.join( self.global_config['jobs_working_dir'], dataset['determined_path'], dataset['name'] + '.log' @@ -296,7 +296,7 @@ class Runner(threading.Thread): utils.execute_to_log( cmd, - dataset['log_file_path'], + dataset['job_log_file_path'], watch_logs=[ ('[syslog]', syslog), ('[sqlslo]', sqlslo),