Skip to content

Commit 393e005

Browse files
authored
Merge pull request #20510 from nsoranzo/remove_ToolDocumentCache
Remove deprecated tool document cache
2 parents 8e848f1 + 8234c78 commit 393e005

File tree

37 files changed

+555
-597
lines changed

37 files changed

+555
-597
lines changed

client/src/api/schema/schema.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24498,7 +24498,9 @@ export interface operations {
2449824498
[name: string]: unknown;
2449924499
};
2450024500
content: {
24501-
"application/json": unknown;
24501+
"application/json": {
24502+
[key: string]: unknown;
24503+
};
2450224504
};
2450324505
};
2450424506
/** @description Request Error */

doc/source/admin/galaxy_options.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,22 +1217,6 @@
12171217
:Type: str
12181218

12191219

1220-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1221-
``enable_tool_document_cache``
1222-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1223-
1224-
:Description:
1225-
This option is deprecated, and the tool document cache will be
1226-
removed in the next release. Whether to enable the tool document
1227-
cache. This cache stores expanded XML strings. Enabling the tool
1228-
cache results in slightly faster startup times. The tool cache is
1229-
backed by a SQLite database, which cannot be stored on certain
1230-
network disks. The cache location is configurable with the
1231-
``tool_cache_data_dir`` tag in tool config files.
1232-
:Default: ``false``
1233-
:Type: bool
1234-
1235-
12361220
~~~~~~~~~~~~~~~~~~~~~~~~~
12371221
``tool_search_index_dir``
12381222
~~~~~~~~~~~~~~~~~~~~~~~~~

lib/galaxy/app.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,6 @@ def __init__(self, **kwargs) -> None:
788788
self.datatypes_registry.load_external_metadata_tool(self.toolbox)
789789
# Load history import/export tools.
790790
load_lib_tools(self.toolbox)
791-
self.toolbox.persist_cache(register_postfork=True)
792791
# visualizations registry: associates resources with visualizations, controls how to render
793792
self.visualizations_registry = self._register_singleton(
794793
VisualizationsRegistry,

lib/galaxy/app_unittest_utils/galaxy_mock.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,6 @@ def __init__(self, **kwargs):
267267
self.version_major = "19.09"
268268

269269
# set by MockDir
270-
self.enable_tool_document_cache = False
271-
self.tool_cache_data_dir = os.path.join(self.root, "tool_cache")
272270
self.external_chown_script = None
273271
self.check_job_script_integrity = False
274272
self.check_job_script_integrity_count = 0

lib/galaxy/config/sample/galaxy.yml.sample

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -935,15 +935,6 @@ galaxy:
935935
# generated commands run in sh.
936936
#default_job_shell: /bin/bash
937937

938-
# This option is deprecated, and the tool document cache will be
939-
# removed in the next release. Whether to enable the tool document
940-
# cache. This cache stores expanded XML strings. Enabling the tool
941-
# cache results in slightly faster startup times. The tool cache is
942-
# backed by a SQLite database, which cannot be stored on certain
943-
# network disks. The cache location is configurable with the
944-
# ``tool_cache_data_dir`` tag in tool config files.
945-
#enable_tool_document_cache: false
946-
947938
# Directory in which the toolbox search index is stored. The value of
948939
# this option will be resolved with respect to <data_dir>.
949940
#tool_search_index_dir: tool_search_index

lib/galaxy/config/schemas/config_schema.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -882,19 +882,6 @@ mapping:
882882
should be disabled. Containerized jobs always use /bin/sh - so more maximum
883883
portability tool authors should assume generated commands run in sh.
884884
885-
enable_tool_document_cache:
886-
type: bool
887-
default: false
888-
required: false
889-
desc: |
890-
This option is deprecated, and the tool document cache will be removed
891-
in the next release.
892-
Whether to enable the tool document cache. This cache stores
893-
expanded XML strings. Enabling the tool cache results in slightly faster startup
894-
times. The tool cache is backed by a SQLite database, which cannot
895-
be stored on certain network disks. The cache location is configurable
896-
with the ``tool_cache_data_dir`` tag in tool config files.
897-
898885
tool_search_index_dir:
899886
type: str
900887
default: tool_search_index

lib/galaxy/dependencies/pinned-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ social-auth-core==4.7.0
187187
sortedcontainers==2.4.0
188188
spython==0.3.14
189189
sqlalchemy==2.0.40
190-
sqlitedict==2.1.0
191190
sqlparse==0.5.3
192191
starlette==0.47.2
193192
starlette-context==0.4.0

lib/galaxy/managers/tools.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ def tool_payload_to_tool(app, tool_dict: Dict[str, Any]) -> Optional[Tool]:
5353
return tool
5454

5555

56-
class DynamicToolManager(ModelManager[model.DynamicTool]):
56+
class DynamicToolManager(ModelManager[DynamicTool]):
5757
"""Manages dynamic tools stored in Galaxy's database."""
5858

59-
model_class = model.DynamicTool
59+
model_class = DynamicTool
6060

6161
def ensure_can_use_unprivileged_tool(self, user: model.User):
6262
stmt = select(
@@ -70,7 +70,7 @@ def ensure_can_use_unprivileged_tool(self, user: model.User):
7070
if not self.session().execute(stmt).scalar():
7171
raise exceptions.InsufficientPermissionsException("User is not allowed to run unprivileged tools")
7272

73-
def get_tool_by_id_or_uuid(self, id_or_uuid: Union[int, str]):
73+
def get_tool_by_id_or_uuid(self, id_or_uuid: Union[int, str]) -> Union[DynamicTool, None]:
7474
if isinstance(id_or_uuid, int):
7575
return self.get_tool_by_id(id_or_uuid)
7676
else:
@@ -213,9 +213,10 @@ def deactivate_unprivileged_tool(self, user: model.User, dynamic_tool: DynamicTo
213213
session.execute(update_stmt)
214214
session.commit()
215215

216-
def deactivate(self, dynamic_tool):
217-
self.update(dynamic_tool, {"active": False})
218-
return dynamic_tool
216+
def deactivate(self, dynamic_tool: DynamicTool) -> DynamicTool:
217+
assert isinstance(dynamic_tool.uuid, UUID)
218+
del self.app.toolbox._tools_by_uuid[dynamic_tool.uuid]
219+
return self.update(dynamic_tool, {"active": False})
219220

220221

221222
class ToolFilterMixin:

lib/galaxy/model/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def get_uuid(uuid: Optional[Union[UUID, str]] = None) -> UUID:
341341
return uuid
342342
if not uuid:
343343
return uuid4()
344-
return UUID(str(uuid))
344+
return UUID(uuid)
345345

346346

347347
def to_json(sa_session, column, keys: List[str]):

lib/galaxy/queue_worker.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
import threading
1212
import time
1313
from inspect import ismodule
14-
from typing import TYPE_CHECKING
14+
from typing import (
15+
Optional,
16+
TYPE_CHECKING,
17+
)
1518

1619
from kombu import (
1720
Consumer,
@@ -33,10 +36,14 @@
3336
log = logging.getLogger(__name__)
3437

3538
if TYPE_CHECKING:
36-
from galaxy.structured_app import MinimalManagerApp
39+
from galaxy.app import UniverseApplication
40+
from galaxy.structured_app import (
41+
MinimalManagerApp,
42+
StructuredApp,
43+
)
3744

3845

39-
def send_local_control_task(app, task, get_response=False, kwargs=None):
46+
def send_local_control_task(app: "StructuredApp", task: str, get_response: bool = False, kwargs: Optional[dict] = None):
4047
"""
4148
This sends a message to the process-local control worker, which is useful
4249
for one-time asynchronous tasks like recalculating user disk usage.
@@ -162,7 +169,7 @@ def reload_tool(app, **kwargs):
162169
log.error("Reload tool invoked without tool id.")
163170

164171

165-
def reload_toolbox(app, save_integrated_tool_panel=True, **kwargs):
172+
def reload_toolbox(app: "UniverseApplication", save_integrated_tool_panel: bool = True, **kwargs) -> None:
166173
reload_timer = util.ExecutionTimer()
167174
log.debug("Executing toolbox reload on '%s'", app.config.server_name)
168175
reload_count = app.toolbox._reload_count
@@ -174,7 +181,7 @@ def reload_toolbox(app, save_integrated_tool_panel=True, **kwargs):
174181
log.debug("Toolbox reload %s", reload_timer)
175182

176183

177-
def _get_new_toolbox(app, save_integrated_tool_panel=True):
184+
def _get_new_toolbox(app: "UniverseApplication", save_integrated_tool_panel: bool = True) -> None:
178185
"""
179186
Generate a new toolbox, by constructing a toolbox from the config files,
180187
and then adding pre-existing data managers from the old toolbox to the new toolbox.
@@ -188,9 +195,9 @@ def _get_new_toolbox(app, save_integrated_tool_panel=True):
188195
app.datatypes_registry.load_datatype_converters(new_toolbox, use_cached=True)
189196
app.datatypes_registry.load_external_metadata_tool(new_toolbox)
190197
load_lib_tools(new_toolbox)
191-
[new_toolbox.register_tool(tool) for tool in new_toolbox.data_manager_tools.values()]
198+
for tool in new_toolbox.data_manager_tools.values():
199+
new_toolbox.register_tool(tool)
192200
app._toolbox = new_toolbox
193-
app.toolbox.persist_cache()
194201

195202

196203
def reload_data_managers(app, **kwargs):

0 commit comments

Comments
 (0)