Skip to content

Commit

Permalink
Add setting that lets admins enable/disable the tool document cache
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Jan 20, 2021
1 parent da0d41f commit 4d984c5
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
15 changes: 15 additions & 0 deletions doc/source/admin/galaxy_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,21 @@
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``enable_tool_document_cache``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
Set this to false to disable the tool document cache. This cache
stores expanded xml strings. Disabling the tool cache results in
slower startup times. The tool cache is backed by sqlite database,
which cannot be stored on certain network disks. The cache
location is configurable using the ``tool_cache_data_dir``
setting, but can be disabled completely here.
:Default: ``true``
:Type: bool


~~~~~~~~~~~~~~~~~~~~~~~
``tool_cache_data_dir``
~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
8 changes: 8 additions & 0 deletions lib/galaxy/config/sample/galaxy.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,14 @@ galaxy:
# generated commands run in sh.
#default_job_shell: /bin/bash

# Set this to false to disable the tool document cache. This cache
# stores expanded xml strings. Disabling the tool cache results in
# slower startup times. The tool cache is backed by sqlite database,
# which cannot be stored on certain network disks. The cache location
# is configurable using the ``tool_cache_data_dir`` setting, but can
# be disabled completely here.
#enable_tool_document_cache: true

# Tool related caching. Fully expanded tools and metadata will be
# stored at this path. Per tool_conf cache locations can be configured
# in (``shed_``)tool_conf.xml files using the tool_cache_data_dir
Expand Down
9 changes: 5 additions & 4 deletions lib/galaxy/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,14 @@ def tools_by_id(self):
return self._tools_by_id

def get_cache_region(self, tool_cache_data_dir):
if tool_cache_data_dir not in self.cache_regions:
self.cache_regions[tool_cache_data_dir] = ToolDocumentCache(cache_dir=tool_cache_data_dir)
return self.cache_regions[tool_cache_data_dir]
if self.app.config.enable_tool_document_cache:
if tool_cache_data_dir not in self.cache_regions:
self.cache_regions[tool_cache_data_dir] = ToolDocumentCache(cache_dir=tool_cache_data_dir)
return self.cache_regions[tool_cache_data_dir]

def create_tool(self, config_file, tool_cache_data_dir=None, **kwds):
cache = self.get_cache_region(tool_cache_data_dir or self.app.config.tool_cache_data_dir)
if config_file.endswith('.xml') and not cache.disabled:
if config_file.endswith('.xml') and cache and not cache.disabled:
tool_document = cache.get(config_file)
if tool_document:
tool_source = self.get_expanded_tool_source(
Expand Down
11 changes: 11 additions & 0 deletions lib/galaxy/webapps/galaxy/config_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,17 @@ mapping:
should be disabled. Containerized jobs always use /bin/sh - so more maximum
portability tool authors should assume generated commands run in sh.
enable_tool_document_cache:
type: bool
default: true
required: false
desc: |
Set this to false to disable the tool document cache. This cache stores
expanded xml strings. Disabling the tool cache results in slower startup
times. The tool cache is backed by sqlite database, which cannot
be stored on certain network disks. The cache location is configurable
using the ``tool_cache_data_dir`` setting, but can be disabled completely here.
tool_cache_data_dir:
type: str
default: tool_cache
Expand Down

0 comments on commit 4d984c5

Please sign in to comment.