1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/1a68cc962622/ changeset: 1a68cc962622 user: dan date: 2013-03-13 16:55:17 summary: Allow reloading Data Managers of the same ID. affected #: 2 files
diff -r 5b8d2cb81bd023c8d62d8038c37d696b38aa91a7 -r 1a68cc9626220afa542f0ac00951511e7eae56bf lib/galaxy/tools/data_manager/manager.py --- a/lib/galaxy/tools/data_manager/manager.py +++ b/lib/galaxy/tools/data_manager/manager.py @@ -25,8 +25,8 @@ self.filename = xml_filename or self.app.config.data_manager_config_file self.load_from_xml( self.filename ) if self.app.config.shed_data_manager_config_file: - self.load_from_xml( self.app.config.shed_data_manager_config_file, store_tool_path=False ) - def load_from_xml( self, xml_filename, store_tool_path=True ): + self.load_from_xml( self.app.config.shed_data_manager_config_file, store_tool_path=False, replace_existing=True ) + def load_from_xml( self, xml_filename, store_tool_path=True, replace_existing=False ): try: tree = util.parse_xml( xml_filename ) except Exception, e: @@ -44,19 +44,24 @@ tool_path = '.' self.tool_path = tool_path for data_manager_elem in root.findall( 'data_manager' ): - self.load_manager_from_elem( data_manager_elem ) - def load_manager_from_elem( self, data_manager_elem, tool_path=None, add_manager=True ): + self.load_manager_from_elem( data_manager_elem, replace_existing=replace_existing ) + def load_manager_from_elem( self, data_manager_elem, tool_path=None, add_manager=True, replace_existing=False ): try: data_manager = DataManager( self, data_manager_elem, tool_path=tool_path ) except Exception, e: log.error( "Error loading data_manager '%s':\n%s" % ( e, util.xml_to_string( data_manager_elem ) ) ) return None if add_manager: - self.add_manager( data_manager ) + self.add_manager( data_manager, replace_existing=replace_existing ) log.debug( 'Loaded Data Manager: %s' % ( data_manager.id ) ) return data_manager - def add_manager( self, data_manager ): - assert data_manager.id not in self.data_managers, "A data manager has been defined twice: %s" % ( data_manager.id ) + def add_manager( self, data_manager, replace_existing=False ): + if not replace_existing: + assert data_manager.id not in self.data_managers, "A data manager has been defined twice: %s" % ( data_manager.id ) + elif data_manager.id in self.data_managers: + # Data Manager already exists, remove first one and replace with new one + log.warning( "A data manager has been defined twice and will be replaced with the last loaded version: %s" % ( data_manager.id ) ) + self.remove_manager( data_manager.id ) self.data_managers[ data_manager.id ] = data_manager for data_table_name in data_manager.data_tables.keys(): if data_table_name not in self.managed_data_tables:
diff -r 5b8d2cb81bd023c8d62d8038c37d696b38aa91a7 -r 1a68cc9626220afa542f0ac00951511e7eae56bf lib/tool_shed/util/shed_util.py --- a/lib/tool_shed/util/shed_util.py +++ b/lib/tool_shed/util/shed_util.py @@ -1261,7 +1261,7 @@ tool_elem = suc.generate_tool_elem( repository.tool_shed, repository.name, repository.installed_changeset_revision, repository.owner, tool_config_filename, tool, None ) elem.insert( 0, tool_elem ) - data_manager = app.data_managers.load_manager_from_elem( elem, tool_path=shed_config_dict.get( 'tool_path', '' ) ) + data_manager = app.data_managers.load_manager_from_elem( elem, tool_path=shed_config_dict.get( 'tool_path', '' ), replace_existing=True ) if data_manager: rval.append( data_manager ) else:
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.