Introduce abstraction for reindexing tool search.

Fixes re-indexing after tool shed modifications for 5c44ac1 and reduces duplication.
This commit is contained in:
John Chilton
2014-12-23 13:52:39 -05:00
parent 41628b3faf
commit 540b6edacd
2 changed files with 10 additions and 8 deletions
+8 -5
View File
@@ -706,10 +706,7 @@ class ConfiguresGalaxyMixin:
from galaxy import tools
self.toolbox = tools.ToolBox( tool_configs, self.config.tool_path, self )
# Search support for tools
import galaxy.tools.search
index_help = getattr( self.config, "index_tool_help", True )
self.toolbox_search = galaxy.tools.search.ToolBoxSearch( self.toolbox, index_help )
self.reindex_tool_search()
from galaxy.tools.deps import containers
galaxy_root_dir = os.path.abspath(self.config.root)
@@ -720,7 +717,13 @@ class ConfiguresGalaxyMixin:
outputs_to_working_directory=self.config.outputs_to_working_directory,
container_image_cache_path=self.config.container_image_cache_path,
)
self.container_finder = galaxy.tools.deps.containers.ContainerFinder(app_info)
self.container_finder = containers.ContainerFinder(app_info)
def reindex_tool_search( self ):
# Call this when tools are added or removed.
import galaxy.tools.search
index_help = getattr( self.config, "index_tool_help", True )
self.toolbox_search = galaxy.tools.search.ToolBoxSearch( self.toolbox, index_help )
def _configure_tool_data_tables( self, from_shed_config ):
from galaxy.tools.data import ToolDataTableManager
@@ -2,7 +2,6 @@ import logging
import threading
import galaxy.tools
from galaxy.tools.search import ToolBoxSearch
from xml.etree import ElementTree as XmlET
from tool_shed.util import basic_util
@@ -81,7 +80,7 @@ class ToolPanelManager( object ):
if self.app.config.update_integrated_tool_panel:
# Write the current in-memory version of the integrated_tool_panel.xml file to disk.
self.app.toolbox.write_integrated_tool_panel_config_file()
self.app.toolbox_search = ToolBoxSearch( self.app.toolbox )
self.app.reindex_tool_search()
def config_elems_to_xml_file( self, config_elems, config_filename, tool_path ):
"""
@@ -571,7 +570,7 @@ class ToolPanelManager( object ):
# Update the config_elems of the in-memory shed_tool_conf_dict.
shed_tool_conf_dict[ 'config_elems' ] = config_elems
self.app.toolbox.shed_tool_confs[ index ] = shed_tool_conf_dict
self.app.toolbox_search = ToolBoxSearch( self.app.toolbox )
self.app.reindex_tool_search()
if uninstall and self.app.config.update_integrated_tool_panel:
# Write the current in-memory version of the integrated_tool_panel.xml file to disk.
self.app.toolbox.write_integrated_tool_panel_config_file()