From eba90fff5a90cf302effcd2258f659168443aeb8 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Fri, 3 Jul 2026 09:56:57 +0200 Subject: [PATCH] tool_panel_manager: gate shed-install populator behind use_lazy_toolbox --- .../tools/tool_panel_manager.py | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/lib/galaxy/tool_shed/galaxy_install/tools/tool_panel_manager.py b/lib/galaxy/tool_shed/galaxy_install/tools/tool_panel_manager.py index 1a6cdf0dd82..f47ca731316 100644 --- a/lib/galaxy/tool_shed/galaxy_install/tools/tool_panel_manager.py +++ b/lib/galaxy/tool_shed/galaxy_install/tools/tool_panel_manager.py @@ -149,27 +149,31 @@ class ToolPanelManager: shed_tool_conf_dict["config_elems"] = config_elems self.app.toolbox.update_shed_config(shed_tool_conf_dict) self.add_to_shed_tool_config(shed_tool_conf_dict, elem_list) - # Populator writes ``StoredToolSource`` + ``ToolIndexEntry`` + - # whoosh for every new tool file, then broadcasts - # ``reload_tool_source_cache`` so peer Galaxy processes refresh. - # ``create_tool`` raises on index miss, so this MUST run before - # ``load_item`` reaches the seam. - new_paths = _collect_new_tool_paths(elem_list, tool_path) - if new_paths: - from galaxy.tool_source_store.populator import populate_for_paths + # Lazy mode only: the populator writes ``StoredToolSource`` + + # ``ToolIndexEntry`` + whoosh for every new tool file, then + # broadcasts ``reload_tool_source_cache`` so peer Galaxy + # processes refresh. ``create_tool`` raises on index miss, so + # this MUST run before ``load_item`` reaches the seam. Eager + # deployments never touch the store here — + # ``invalidate_index_cache`` only exists on ``LazyToolBox``. + if getattr(self.app.config, "use_lazy_toolbox", False): + new_paths = _collect_new_tool_paths(elem_list, tool_path) + if new_paths: + from galaxy.tool_source_store.populator import populate_for_paths - populate_for_paths( - self.app.config, - self.app.model.context, - paths=new_paths, - rebuild_whoosh=True, - ) - # Refresh THIS process synchronously; the AMQP broadcast - # above only reaches peers asynchronously, but the install - # response should reflect the new tools immediately. - self.app.toolbox.invalidate_index_cache() - # Wire the new tools into the in-memory panel. ``create_tool`` - # now finds them in the index and hands back ``LazyTool`` stubs. + populate_for_paths( + self.app.config, + self.app.model.context, + paths=new_paths, + rebuild_whoosh=True, + ) + # Refresh THIS process synchronously; the AMQP broadcast + # above only reaches peers asynchronously, but the install + # response should reflect the new tools immediately. + self.app.toolbox.invalidate_index_cache() + # Wire the new tools into the in-memory panel. In lazy mode + # ``create_tool`` finds them in the index and hands back + # ``LazyTool`` stubs; in eager mode this parses as before. for config_elem in elem_list: self.app.toolbox.load_item( config_elem,