mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #11186 from mvdbeek/disable_tool_cache_optionally
[21.01] Add setting that lets admins enable/disable the tool document cache
This commit is contained in:
@@ -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``
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -305,13 +305,14 @@ class ToolBox(BaseGalaxyToolBox):
|
||||
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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -170,6 +170,7 @@ class MockAppConfig(Bunch):
|
||||
|
||||
# set by MockDir
|
||||
self.root = root
|
||||
self.enable_tool_document_cache = False
|
||||
self.tool_cache_data_dir = os.path.join(root, 'tool_cache')
|
||||
self.delay_tool_initialization = True
|
||||
self.external_chown_script = None
|
||||
|
||||
Reference in New Issue
Block a user