From d303cf5ffbea29ad9d0d96b167f20606a022a488 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 13 Apr 2017 14:06:11 -0400 Subject: [PATCH] Strip exception strings from being included in log.exception statements across the project. --- lib/galaxy/jobs/deferred/__init__.py | 4 ++-- lib/galaxy/jobs/handler.py | 2 +- lib/galaxy/tools/__init__.py | 2 +- lib/galaxy/tools/verify/asserts/__init__.py | 2 +- lib/galaxy/visualization/genomes.py | 2 +- lib/galaxy/webapps/galaxy/api/history_contents.py | 2 +- lib/galaxy/webapps/galaxy/api/library_contents.py | 8 ++++---- lib/galaxy/webapps/galaxy/controllers/history.py | 2 +- .../model/migrate/versions/0024_password_reset.py | 4 ++-- lib/tool_shed/metadata/metadata_generator.py | 4 ++-- lib/tool_shed/util/commit_util.py | 2 +- lib/tool_shed/util/common_util.py | 6 +++--- lib/tool_shed/util/readme_util.py | 2 +- lib/tool_shed/util/repository_util.py | 2 +- 14 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/galaxy/jobs/deferred/__init__.py b/lib/galaxy/jobs/deferred/__init__.py index 1a0087bc6fe..b3b2c837640 100644 --- a/lib/galaxy/jobs/deferred/__init__.py +++ b/lib/galaxy/jobs/deferred/__init__.py @@ -107,14 +107,14 @@ class DeferredJobQueue( object ): job_state = self.plugins[job.plugin].check_job( job ) except Exception as e: self.__fail_job( job ) - log.exception( 'Set deferred job %s to error because of an exception in check_job(): %s' % ( job.id, str( e ) ) ) + log.exception( 'Set deferred job %s to error because of an exception in check_job()' % job.id ) continue if job_state == self.job_states.READY: try: self.plugins[job.plugin].run_job( job ) except Exception as e: self.__fail_job( job ) - log.exception( 'Set deferred job %s to error because of an exception in run_job(): %s' % ( job.id, str( e ) ) ) + log.exception( 'Set deferred job %s to error because of an exception in run_job()' % job.id ) continue elif job_state == self.job_states.INVALID: self.__fail_job( job ) diff --git a/lib/galaxy/jobs/handler.py b/lib/galaxy/jobs/handler.py index 526a22dbd60..3e1e9d55cfd 100644 --- a/lib/galaxy/jobs/handler.py +++ b/lib/galaxy/jobs/handler.py @@ -785,7 +785,7 @@ class DefaultJobDispatcher( object ): try: return self.job_runners[runner_name].url_to_destination(url) except Exception as e: - log.exception("Unable to convert legacy job runner URL '%s' to job destination, destination will be the '%s' runner with no params: %s" % (url, runner_name, e)) + log.exception("Unable to convert legacy job runner URL '%s' to job destination, destination will be the '%s' runner with no params" % (url, runner_name)) return JobDestination(runner=runner_name) def put( self, job_wrapper ): diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 55242301fff..7dad03f15b9 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -1103,7 +1103,7 @@ class Tool( object, Dictifiable ): try: help_text = tool_shed.util.shed_util_common.set_image_paths( self.app, self.repository_id, help_text ) except Exception as e: - log.exception( "Exception in parse_help, so images may not be properly displayed:\n%s" % str( e ) ) + log.exception( "Exception in parse_help, so images may not be properly displayed" ) try: self.__help = Template( rst_to_html(help_text), input_encoding='utf-8', output_encoding='utf-8', default_filters=[ 'decode.utf8' ], diff --git a/lib/galaxy/tools/verify/asserts/__init__.py b/lib/galaxy/tools/verify/asserts/__init__.py index 51f2c7cf31a..08d3a6ed7d4 100644 --- a/lib/galaxy/tools/verify/asserts/__init__.py +++ b/lib/galaxy/tools/verify/asserts/__init__.py @@ -20,7 +20,7 @@ for assertion_module_name in assertion_module_names: assertion_module = sys.modules[full_assertion_module_name] assertion_modules.append(assertion_module) except Exception as e: - log.exception('Failed to load assertion module: %s %s' % (assertion_module_name, str(e))) + log.exception('Failed to load assertion module: %s' % (assertion_module_name)) def verify_assertions(data, assertion_description_list): diff --git a/lib/galaxy/visualization/genomes.py b/lib/galaxy/visualization/genomes.py index 9c73573f5ae..40093246106 100644 --- a/lib/galaxy/visualization/genomes.py +++ b/lib/galaxy/visualization/genomes.py @@ -216,7 +216,7 @@ class Genomes( object ): twobit_fields[ key ] = path except IOError as e: # Thrown if twobit.loc does not exist. - log.exception( "Error reading twobit.loc: %s", e ) + log.exception( "Error reading twobit.loc" ) for key, description in self.app.genome_builds.get_genome_build_names(): self.genomes[ key ] = Genome( key, description ) # Add len files to genomes. diff --git a/lib/galaxy/webapps/galaxy/api/history_contents.py b/lib/galaxy/webapps/galaxy/api/history_contents.py index 9ce9359b43a..42c5a370594 100644 --- a/lib/galaxy/webapps/galaxy/api/history_contents.py +++ b/lib/galaxy/webapps/galaxy/api/history_contents.py @@ -162,7 +162,7 @@ class HistoryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar ) return self.__collection_dict( trans, dataset_collection_instance, view="element" ) except Exception as e: - log.exception( "Error in history API at listing dataset collection: %s", e ) + log.exception( "Error in history API at listing dataset collection" ) trans.response.status = 500 return { 'error': str( e ) } diff --git a/lib/galaxy/webapps/galaxy/api/library_contents.py b/lib/galaxy/webapps/galaxy/api/library_contents.py index c27c93c1a53..d829727c8ca 100644 --- a/lib/galaxy/webapps/galaxy/api/library_contents.py +++ b/lib/galaxy/webapps/galaxy/api/library_contents.py @@ -391,14 +391,14 @@ class LibraryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar rval[ 'deleted' ] = True except exceptions.httpexceptions.HTTPInternalServerError as http_server_err: - log.exception( 'Library_contents API, delete: uncaught HTTPInternalServerError: %s, %s\n%s', - id, str( kwd ), str( http_server_err ) ) + log.exception( 'Library_contents API, delete: uncaught HTTPInternalServerError: %s, %s', + id, str( kwd ) ) raise except exceptions.httpexceptions.HTTPException: raise except Exception as exc: - log.exception( 'library_contents API, delete: uncaught exception: %s, %s\n%s', - id, str( kwd ), str( exc ) ) + log.exception( 'library_contents API, delete: uncaught exception: %s, %s', + id, str( kwd ) ) trans.response.status = 500 rval.update({ 'error': str( exc ) }) return rval diff --git a/lib/galaxy/webapps/galaxy/controllers/history.py b/lib/galaxy/webapps/galaxy/controllers/history.py index 044e2473751..22aebfd98e1 100644 --- a/lib/galaxy/webapps/galaxy/controllers/history.py +++ b/lib/galaxy/webapps/galaxy/controllers/history.py @@ -630,7 +630,7 @@ class HistoryController( BaseUIController, SharableMixin, UsesAnnotations, UsesI except Exception as exc: user_id = str( trans.user.id ) if trans.user else '(anonymous)' - log.exception( 'Error bootstrapping history for user %s: %s', user_id, exc ) + log.exception( 'Error bootstrapping history for user %s', user_id ) if isinstance( exc, exceptions.ItemAccessibilityException ): error_msg = 'You do not have permission to view this history.' else: diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0024_password_reset.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0024_password_reset.py index 63cacb803a3..abf623903b9 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0024_password_reset.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0024_password_reset.py @@ -24,7 +24,7 @@ def upgrade(migrate_engine): PasswordResetToken_table.create() except Exception as e: print str(e) - log.exception("Creating %s table failed: %s" % (PasswordResetToken_table.name, str( e ) ) ) + log.exception("Creating %s table failed" % PasswordResetToken_table.name ) def downgrade(migrate_engine): @@ -34,4 +34,4 @@ def downgrade(migrate_engine): PasswordResetToken_table.drop() except Exception as e: print str(e) - log.exception("Dropping %s table failed: %s" % (PasswordResetToken_table.name, str( e ) ) ) + log.exception("Dropping %s table failed" % PasswordResetToken_table.name ) diff --git a/lib/tool_shed/metadata/metadata_generator.py b/lib/tool_shed/metadata/metadata_generator.py index 026af275ffe..2b02ccfb179 100644 --- a/lib/tool_shed/metadata/metadata_generator.py +++ b/lib/tool_shed/metadata/metadata_generator.py @@ -451,8 +451,8 @@ class MetadataGenerator( object ): try: exported_workflow_dict = json.loads( workflow_text ) except Exception as e: - log.exception( "Skipping file %s since it does not seem to be a valid exported Galaxy workflow: %s" - % ( str( relative_path ), str( e ) ) ) + log.exception( "Skipping file %s since it does not seem to be a valid exported Galaxy workflow" + % str( relative_path ) ) valid_exported_galaxy_workflow = False if valid_exported_galaxy_workflow and \ 'a_galaxy_workflow' in exported_workflow_dict and \ diff --git a/lib/tool_shed/util/commit_util.py b/lib/tool_shed/util/commit_util.py index ccceef68762..f6489157538 100644 --- a/lib/tool_shed/util/commit_util.py +++ b/lib/tool_shed/util/commit_util.py @@ -238,7 +238,7 @@ def handle_gzip( repository, uploaded_file_name ): except IOError as e: os.close( fd ) os.remove( uncompressed ) - log.exception( 'Problem uncompressing gz data "%s": %s' % ( uploaded_file_name, str( e ) ) ) + log.exception( 'Problem uncompressing gz data "%s"' % uploaded_file_name ) return if not chunk: break diff --git a/lib/tool_shed/util/common_util.py b/lib/tool_shed/util/common_util.py index 0302227c312..170e833145f 100644 --- a/lib/tool_shed/util/common_util.py +++ b/lib/tool_shed/util/common_util.py @@ -178,7 +178,7 @@ def get_protocol_from_tool_shed_url( tool_shed_url ): # We receive a lot of calls here where the tool_shed_url is None. The container_util uses # that value when creating a header row. If the tool_shed_url is not None, we have a problem. if tool_shed_url is not None: - log.exception( "Handled exception getting the protocol from Tool Shed URL %s:\n%s", str( tool_shed_url ), e ) + log.exception( "Handled exception getting the protocol from Tool Shed URL %s", str( tool_shed_url ) ) # Default to HTTP protocol. return 'http' @@ -276,7 +276,7 @@ def handle_tool_shed_url_protocol( app, shed_url ): # We receive a lot of calls here where the tool_shed_url is None. The container_util uses # that value when creating a header row. If the tool_shed_url is not None, we have a problem. if shed_url is not None: - log.exception( "Handled exception removing protocol from URL %s:\n%s", str( shed_url ), e ) + log.exception( "Handled exception removing protocol from URL %s", str( shed_url ) ) return shed_url @@ -317,7 +317,7 @@ def remove_port_from_tool_shed_url( tool_shed_url ): # We receive a lot of calls here where the tool_shed_url is None. The container_util uses # that value when creating a header row. If the tool_shed_url is not None, we have a problem. if tool_shed_url is not None: - log.exception( "Handled exception removing the port from Tool Shed URL %s:\n%s", str( tool_shed_url ), e ) + log.exception( "Handled exception removing the port from Tool Shed URL %s", str( tool_shed_url ) ) return tool_shed_url diff --git a/lib/tool_shed/util/readme_util.py b/lib/tool_shed/util/readme_util.py index 59333f2457f..82a62b873ad 100644 --- a/lib/tool_shed/util/readme_util.py +++ b/lib/tool_shed/util/readme_util.py @@ -58,7 +58,7 @@ def build_readme_files_dict( app, repository, changeset_revision, metadata, tool app.security.encode_id( repository.id ), text_of_reasonable_length ) except Exception as e: - log.exception( "Exception in build_readme_files_dict, so images may not be properly displayed:\n%s" % str( e ) ) + log.exception( "Exception in build_readme_files_dict, so images may not be properly displayed" ) finally: lock.release() if readme_file_name.endswith( '.rst' ): diff --git a/lib/tool_shed/util/repository_util.py b/lib/tool_shed/util/repository_util.py index b25b0016fff..74426d1c58a 100644 --- a/lib/tool_shed/util/repository_util.py +++ b/lib/tool_shed/util/repository_util.py @@ -813,7 +813,7 @@ def get_tool_shed_status_for_installed_repository( app, repository ): # The required tool shed may be unavailable, so default the revision_update value to 'false'. return dict( revision_update='false' ) except Exception as e: - log.exception( "Error attempting to get tool shed status for installed repository %s: %s" % ( str( repository.name ), str( e ) ) ) + log.exception( "Error attempting to get tool shed status for installed repository %s" % str( repository.name ) ) return {}