mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-21 05:45:37 +08:00
app: declare tool_source_store, drop the getattr guards
_init_tool_source_store assigns the attribute unconditionally (None when use_cached_toolbox is off), so every real app has it; the getattr spellings only papered over mock apps, which now declare the attribute instead.
This commit is contained in:
@@ -451,10 +451,9 @@ class MinimalGalaxyApplication(BasicSharedApp, HaltableContainer, SentryClientMi
|
||||
self.haltables.insert(2, ("cached toolbox", self._shutdown_cached_toolbox))
|
||||
|
||||
def _shutdown_tool_source_store(self) -> None:
|
||||
store = getattr(self, "tool_source_store", None)
|
||||
if store is not None:
|
||||
if self.tool_source_store is not None:
|
||||
try:
|
||||
store.close()
|
||||
self.tool_source_store.close()
|
||||
finally:
|
||||
self.tool_source_store = None
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ from galaxy.tool_util.deps.containers import NullContainerFinder
|
||||
from galaxy.tools import ToolBox
|
||||
from galaxy.tools.cache import ToolCache
|
||||
from galaxy.tools.data import ToolDataTableManager
|
||||
from galaxy.tools.source_store import ToolSourceStore
|
||||
from galaxy.util import (
|
||||
galaxy_directory,
|
||||
StructuredExecutionTimer,
|
||||
@@ -126,6 +127,7 @@ class MockApp(di.Container, GalaxyDataTestApp):
|
||||
execution_timer_factory: Any
|
||||
stop: bool
|
||||
is_webapp: bool = True
|
||||
tool_source_store: ToolSourceStore | None = None
|
||||
|
||||
def __init__(self, config=None, **kwargs) -> None:
|
||||
super().__init__()
|
||||
|
||||
@@ -297,7 +297,7 @@ def _get_new_toolbox(app: "UniverseApplication", save_integrated_tool_panel: boo
|
||||
|
||||
with app._toolbox_lock:
|
||||
new_toolbox: ToolBox
|
||||
if getattr(app.config, "use_cached_toolbox", False) and getattr(app, "tool_source_store", None) is not None:
|
||||
if app.config.use_cached_toolbox and app.tool_source_store is not None:
|
||||
new_toolbox = CachedToolBox(
|
||||
config_filenames=tool_configs,
|
||||
tool_root_dir=app.config.tool_path,
|
||||
|
||||
@@ -566,7 +566,7 @@ class ToolBox(AbstractToolBox):
|
||||
file_count = self._tools_parsed_from_file
|
||||
|
||||
if store_count > 0 or file_count > 0:
|
||||
store = getattr(self.app, "tool_source_store", None)
|
||||
store = self.app.tool_source_store
|
||||
backend = "unknown"
|
||||
if store:
|
||||
try:
|
||||
@@ -697,7 +697,7 @@ class ToolBox(AbstractToolBox):
|
||||
if not self.app.config.use_cached_toolbox:
|
||||
return None
|
||||
|
||||
store = getattr(self.app, "tool_source_store", None)
|
||||
store = self.app.tool_source_store
|
||||
if store is None:
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user