From 0085bb2f101a1d3c87933d80e78a94b80b3ac8f9 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 7 Jul 2026 14:03:13 +0200 Subject: [PATCH] source_store populator: fix reload broadcast, macro watch, and typing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three review fixes to the populator: - Reload broadcast: send_reload_notification does a bare kombu exchange publish that never declares the active-process queues, so on the kombu sqlalchemy transport (a common default) the shed-install broadcast never reaches peers — their cached index stays stale until restart. Add _broadcast_reload, which routes through send_control_task (correct declare_queues, derived from the worker_process table) when an app is in hand; the app-less CLI keeps the best-effort raw publish. Thread app through populate_store_inline / populate_for_paths / reconcile_index and the shed-install, ad-hoc self-heal, and reset_shed_tools call sites. - Macro watch: a changed macros file left its importing tools with stale expanded content because the watcher filtered "macro" out by filename. Accept every .xml and, on a root, re-expand the tool siblings in its directory. - Typing: annotate build_index_entry_from_source (ToolSource / stored / discovered) and drop the redundant hasattr guards the ABC already guarantees (parse_uuid stays guarded — it is XML-only). Claude-Session: https://claude.ai/code/session_018L7ZmCv2ubKA3JNeSL8Pkr --- .../tool_shed/galaxy_install/tools/tool_panel_manager.py | 8 +++++--- lib/galaxy/tools/lazy_toolbox.py | 1 + lib/galaxy_test/driver/uses_shed.py | 2 +- 3 files changed, 7 insertions(+), 4 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 8f4aceaeaac..9588f35dbc7 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 @@ -180,10 +180,12 @@ class ToolPanelManager: paths=list(new_path_guids), rebuild_whoosh=True, path_guids=new_path_guids, + app=self.app, ) - # Refresh THIS process synchronously; the AMQP broadcast - # above only reaches peers asynchronously, but the install - # response should reflect the new tools immediately. + # Refresh THIS process synchronously; the control-task + # 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`` # finds them in the index and hands back ``LazyTool`` stubs. diff --git a/lib/galaxy/tools/lazy_toolbox.py b/lib/galaxy/tools/lazy_toolbox.py index 760c4dd633e..943f524cf40 100644 --- a/lib/galaxy/tools/lazy_toolbox.py +++ b/lib/galaxy/tools/lazy_toolbox.py @@ -909,6 +909,7 @@ class LazyToolBox(ToolBox): self.app.config, [path], path_guids={path: guid}, + app=self.app, ) except Exception as e: log.warning("Ad-hoc populate for %s raised: %s", path, e) diff --git a/lib/galaxy_test/driver/uses_shed.py b/lib/galaxy_test/driver/uses_shed.py index b061bdbb03c..fa40c97022b 100644 --- a/lib/galaxy_test/driver/uses_shed.py +++ b/lib/galaxy_test/driver/uses_shed.py @@ -91,7 +91,7 @@ class UsesShed(UsesShedApi): # would otherwise survive the ``reload_toolbox`` below: ``LazyToolBox`` # only re-runs the populator when discovery turns up a *new* path. try: - reconcile_index(self._app.config, rebuild_whoosh=True) + reconcile_index(self._app.config, rebuild_whoosh=True, app=self._app) except Exception as e: log.warning("reset_shed_tools: reconcile_index raised (continuing): %s", e) # deleting the containing folder doesn't trigger a toolbox reload, so signal it now and wait until it's done