mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-21 13:50:20 +08:00
Only build toolbox index for webapps, delay until after startup
This commit is contained in:
+9
-1
@@ -24,7 +24,10 @@ from galaxy.managers.users import UserManager
|
||||
from galaxy.managers.workflows import WorkflowsManager
|
||||
from galaxy.model.database_heartbeat import DatabaseHeartbeat
|
||||
from galaxy.model.tags import GalaxyTagHandler
|
||||
from galaxy.queue_worker import GalaxyQueueWorker
|
||||
from galaxy.queue_worker import (
|
||||
send_local_control_task,
|
||||
GalaxyQueueWorker,
|
||||
)
|
||||
from galaxy.tool_shed.galaxy_install.installed_repository_manager import InstalledRepositoryManager
|
||||
from galaxy.tool_shed.galaxy_install.update_repository_manager import UpdateRepositoryManager
|
||||
from galaxy.tool_util.deps.views import DependencyResolversView
|
||||
@@ -65,6 +68,8 @@ class UniverseApplication(config.ConfiguresGalaxyMixin):
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
log.debug("python path is: %s", ", ".join(sys.path))
|
||||
self.name = 'galaxy'
|
||||
# is_webapp will be set to true when building WSGI app
|
||||
self.is_webapp = False
|
||||
self.startup_timer = ExecutionTimer()
|
||||
self.new_installation = False
|
||||
# Read config file and check for errors
|
||||
@@ -244,6 +249,9 @@ class UniverseApplication(config.ConfiguresGalaxyMixin):
|
||||
|
||||
# Start web stack message handling
|
||||
self.application_stack.register_postfork_function(self.application_stack.start)
|
||||
self.application_stack.register_postfork_function(self.queue_worker.bind_and_start)
|
||||
# Delay toolbox index until after startup
|
||||
self.application_stack.register_postfork_function(lambda: send_local_control_task(self, 'rebuild_toolbox_search_index'))
|
||||
|
||||
self.model.engine.dispose()
|
||||
|
||||
|
||||
@@ -1032,7 +1032,6 @@ class ConfiguresGalaxyMixin(object):
|
||||
self._set_enabled_container_types()
|
||||
index_help = getattr(self.config, "index_tool_help", True)
|
||||
self.toolbox_search = galaxy.tools.search.ToolBoxSearch(self.toolbox, index_help)
|
||||
self.reindex_tool_search()
|
||||
|
||||
def reindex_tool_search(self):
|
||||
# Call this when tools are added or removed.
|
||||
|
||||
@@ -247,8 +247,11 @@ def reload_tool_data_tables(app, **kwargs):
|
||||
|
||||
|
||||
def rebuild_toolbox_search_index(app, **kwargs):
|
||||
if app.toolbox_search.index_count < app.toolbox._reload_count:
|
||||
app.reindex_tool_search()
|
||||
if app.is_webapp:
|
||||
if app.toolbox_search.index_count < app.toolbox._reload_count:
|
||||
app.reindex_tool_search()
|
||||
else:
|
||||
log.debug("App is not a webapp, not building a search index")
|
||||
|
||||
|
||||
def reload_job_rules(app, **kwargs):
|
||||
|
||||
@@ -79,6 +79,7 @@ class WebApplication(base.WebApplication):
|
||||
def __init__(self, galaxy_app, session_cookie='galaxysession', name=None):
|
||||
self.name = name
|
||||
base.WebApplication.__init__(self)
|
||||
galaxy_app.is_webapp = True
|
||||
self.set_transaction_factory(lambda e: self.transaction_chooser(e, galaxy_app, session_cookie))
|
||||
# Mako support
|
||||
self.mako_template_lookup = self.create_mako_template_lookup(galaxy_app, name)
|
||||
|
||||
@@ -204,7 +204,6 @@ uwsgi_app_factory = uwsgi_app
|
||||
|
||||
def postfork_setup():
|
||||
from galaxy.app import app
|
||||
app.queue_worker.bind_and_start()
|
||||
app.application_stack.log_startup()
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ class UniverseApplication(object):
|
||||
def __init__(self, **kwd):
|
||||
log.debug("python path is: %s", ", ".join(sys.path))
|
||||
self.name = "tool_shed"
|
||||
# will be overwritten when building WSGI app
|
||||
self.is_webapp = False
|
||||
# Read the tool_shed.ini configuration file and check for errors.
|
||||
self.config = config.Configuration(**kwd)
|
||||
self.config.check()
|
||||
|
||||
@@ -108,7 +108,6 @@ def load_galaxy_app(
|
||||
**kwds
|
||||
)
|
||||
app.database_heartbeat.start()
|
||||
app.queue_worker.bind_and_start()
|
||||
app.application_stack.log_startup()
|
||||
return app
|
||||
|
||||
|
||||
Reference in New Issue
Block a user