commit/galaxy-central: jmchilton: More informative exceptions for startup failure due to job config XML errors.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/46523237518b/ Changeset: 46523237518b User: jmchilton Date: 2014-10-09 19:04:38+00:00 Summary: More informative exceptions for startup failure due to job config XML errors. Describe that this is an XML formatting issue that is causing the problem and include the full path of the file when to the user starting Galaxy. Inspired by problems described here: https://biostar.usegalaxy.org/p/9245/. Affected #: 1 file diff -r dd0d4fa44feb1d620a288093cb72e1b83811ce0f -r 46523237518bb9ec8ed9fa4cf30453c800580c24 lib/galaxy/jobs/__init__.py --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -91,6 +91,15 @@ return self.get( "resources", None ) +def config_exception(e, file): + abs_path = os.path.abspath(file) + message = 'Problem parsing the XML in file %s, ' % abs_path + message += 'please correct the indicated portion of the file and restart Galaxy.' + message += str(e) + log.exception(message) + return Exception(message) + + class JobConfiguration( object ): """A parser and interface to advanced job management features. @@ -118,12 +127,15 @@ self.__parse_resource_parameters() # Initialize the config + job_config_file = self.app.config.job_config_file try: - tree = util.parse_xml(self.app.config.job_config_file) + tree = util.parse_xml(job_config_file) self.__parse_job_conf_xml(tree) except IOError: log.warning( 'Job configuration "%s" does not exist, using legacy job configuration from Galaxy config file "%s" instead' % ( self.app.config.job_config_file, self.app.config.config_file ) ) self.__parse_job_conf_legacy() + except Exception as e: + raise config_exception(e, job_config_file) def __parse_job_conf_xml(self, tree): """Loads the new-style job configuration from options in the job config file (by default, job_conf.xml). @@ -358,7 +370,12 @@ if not os.path.exists( self.app.config.job_resource_params_file ): return - resource_definitions = util.parse_xml( self.app.config.job_resource_params_file ) + resource_param_file = self.app.config.job_resource_params_file + try: + resource_definitions = util.parse_xml( resource_param_file ) + except Exception as e: + raise config_exception(e, resource_param_file) + resource_definitions_root = resource_definitions.getroot() # TODO: Also handling conditionals would be awesome! for parameter_elem in resource_definitions_root.findall( "param" ): Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org