Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose additional beaker caching backends #15349

Merged
merged 15 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 172 additions & 1 deletion doc/source/admin/galaxy_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@
container resolvers to use when discovering containers for Galaxy.
If this is set to None, the default container resolvers loaded is
determined by enable_mulled_containers. For available options see
config/container_resolvers_conf.xml.sample.
https://docs.galaxyproject.org/en/master/admin/container_resolvers.html
:Default: ``None``
:Type: str

Expand Down Expand Up @@ -1255,6 +1255,43 @@
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``biotools_service_cache_url``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
When biotools_service_cache_type = ext:database, this is the url
of the database used by beaker for bio.tools web service request
related caching. The application config code will set it to the
value of database_connection if this is not set.
:Default: ``None``
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``biotools_service_cache_table_name``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
When biotools_service_cache_type = ext:database, this is the
database table name used by beaker for bio.tools web service
request related caching.
:Default: ``beaker_cache``
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``biotools_service_cache_schema_name``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
When biotools_service_cache_type = ext:database, this is the
database table name used by beaker for bio.tools web service
request related caching.
:Default: ``None``
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~
``citation_cache_type``
~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -1298,6 +1335,42 @@
:Type: str


~~~~~~~~~~~~~~~~~~~~~~
``citation_cache_url``
~~~~~~~~~~~~~~~~~~~~~~

:Description:
When citation_cache_type = ext:database, this is the url of the
database used by beaker for citation caching. The application
config code will set it to the value of database_connection if
this is not set.
:Default: ``None``
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``citation_cache_table_name``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
When citation_cache_type = ext:database, this is the database
table name used by beaker for citation related caching.
:Default: ``beaker_cache``
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``citation_cache_schema_name``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
When citation_cache_type = ext:database, this is the database
schema name of the table used by beaker for citation related
caching.
:Default: ``None``
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``mulled_resolution_cache_type``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -1347,6 +1420,43 @@
:Type: int


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``mulled_resolution_cache_url``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
When mulled_resolution_cache_type = ext:database, this is the url
of the database used by beaker for caching mulled resolution
requests. The application config code will set it to the value of
database_connection if this is not set.
:Default: ``None``
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``mulled_resolution_cache_table_name``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
When mulled_resolution_cache_type = ext:database, this is the
database table name used by beaker for caching mulled resolution
requests.
:Default: ``beaker_cache``
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``mulled_resolution_cache_schema_name``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
When mulled_resolution_cache_type = ext:database, this is the
database schema name of the table used by beaker for caching
mulled resolution requests.
:Default: ``None``
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``object_store_config_file``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -1360,6 +1470,67 @@
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``object_store_cache_monitor_driver``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
Specify where cache monitoring is driven for caching object stores
such as S3, Azure, and iRODS. This option has no affect on disk
object stores. For production instances, the cache should be
monitored by external tools such as tmpwatch and this value should
be set to 'external'. This will disable all cache monitoring in
Galaxy. Alternatively, 'celery' can monitor caches using a
periodic task or an 'inprocess' thread can be used - but this last
option seriously limits Galaxy's ability to scale. The default of
'auto' will use 'celery' if 'enable_celery_tasks' is set to true
or 'inprocess' otherwise. This option serves as the default for
all object stores and can be overridden on a per object store
basis (but don't - just setup tmpwatch for all relevant cache
paths).
:Default: ``auto``
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``object_store_cache_monitor_interval``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
For object store cache monitoring done by Galaxy, this is the
interval between cache checking steps. This is used by both
inprocess cache monitors (which we recommend you do not use) and
by the celery task if it is configured (by setting
enable_celery_tasks to true and not setting
object_store_cache_monitor_driver to external).
:Default: ``600``
:Type: int


~~~~~~~~~~~~~~~~~~~~~~~~~~~
``object_store_cache_path``
~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
Default cache path for caching object stores if cache not
configured for that object store entry.
The value of this option will be resolved with respect to
<cache_dir>.
:Default: ``object_store_cache``
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~
``object_store_cache_size``
~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
Default cache size for caching object stores if cache not
configured for that object store entry.
:Default: ``-1``
:Type: int


~~~~~~~~~~~~~~~~~~~~~~~~~
``object_store_store_by``
~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
3 changes: 3 additions & 0 deletions lib/galaxy/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ def _configure_toolbox(self):
"cache.data_dir": self.config.mulled_resolution_cache_data_dir,
"cache.lock_dir": self.config.mulled_resolution_cache_lock_dir,
"cache.expire": self.config.mulled_resolution_cache_expire,
"cache.url": self.config.mulled_resolution_cache_url,
"cache.table_name": self.config.mulled_resolution_cache_table_name,
"cache.schema_name": self.config.mulled_resolution_cache_schema_name,
}
mulled_resolution_cache = CacheManager(**parse_cache_config_options(cache_opts)).get_cache(
"mulled_resolution"
Expand Down
23 changes: 23 additions & 0 deletions lib/galaxy/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@
}
"""Default value for logging configuration, passed to :func:`logging.config.dictConfig`"""

DEPENDENT_CONFIG_DEFAULTS: Dict[str, str] = {
"mulled_resolution_cache_url": "database_connection",
"citation_cache_url": "database_connection",
"biotools_service_cache_url": "database_connection",
}
"""Config parameters whose default is the value of another config parameter
This should be moved to a .yml config file.
"""

VERSION_JSON_FILE = "version.json"
DEFAULT_EMAIL_FROM_LOCAL_PART = "galaxy-no-reply"
DISABLED_FLAG = "disabled" # Used to mark a config option as disabled
Expand Down Expand Up @@ -731,6 +740,20 @@ def __init__(self, **kwargs):
self._override_tempdir(kwargs)
self._configure_sqlalchemy20_warnings(kwargs)
self._process_config(kwargs)
self._set_dependent_defaults()

def _set_dependent_defaults(self):
"""Set values of unset parameters which take their default values from other parameters"""
for dependent_config_param, config_param in DEPENDENT_CONFIG_DEFAULTS.items():
try:
if getattr(self, dependent_config_param) is None:
setattr(self, dependent_config_param, getattr(self, config_param))
except AttributeError:
raise Exception(
"One or more invalid config parameter names specified in "
"DEPENDENT_CONFIG_DEFAULTS, "
f"{dependent_config_param}, {config_param}"
)

def _configure_sqlalchemy20_warnings(self, kwargs):
"""
Expand Down
78 changes: 78 additions & 0 deletions lib/galaxy/config/sample/galaxy.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,22 @@ galaxy:
# <cache_dir>.
#biotools_service_cache_lock_dir: biotools/locks

# When biotools_service_cache_type = ext:database, this is the url of
# the database used by beaker for bio.tools web service request
# related caching. The application config code will set it to the
# value of database_connection if this is not set.
#biotools_service_cache_url: null

# When biotools_service_cache_type = ext:database, this is the
# database table name used by beaker for bio.tools web service request
# related caching.
#biotools_service_cache_table_name: beaker_cache

# When biotools_service_cache_type = ext:database, this is the
# database table name used by beaker for bio.tools web service request
# related caching.
#biotools_service_cache_schema_name: null

# Citation related caching. Tool citations information maybe fetched
# from external sources such as https://doi.org/ by Galaxy - the
# following parameters can be used to control the caching used to
Expand All @@ -960,6 +976,20 @@ galaxy:
# <cache_dir>.
#citation_cache_lock_dir: citations/locks

# When citation_cache_type = ext:database, this is the url of the
# database used by beaker for citation caching. The application config
# code will set it to the value of database_connection if this is not
# set.
#citation_cache_url: null

# When citation_cache_type = ext:database, this is the database table
# name used by beaker for citation related caching.
#citation_cache_table_name: beaker_cache

# When citation_cache_type = ext:database, this is the database schema
# name of the table used by beaker for citation related caching.
#citation_cache_schema_name: null

# Mulled resolution caching. Mulled resolution uses external APIs of
# quay.io, these requests are caching using this and the following
# parameters
Expand All @@ -981,12 +1011,60 @@ galaxy:
# created.
#mulled_resolution_cache_expire: 3600

# When mulled_resolution_cache_type = ext:database, this is the url of
# the database used by beaker for caching mulled resolution requests.
# The application config code will set it to the value of
# database_connection if this is not set.
#mulled_resolution_cache_url: null

# When mulled_resolution_cache_type = ext:database, this is the
# database table name used by beaker for caching mulled resolution
# requests.
#mulled_resolution_cache_table_name: beaker_cache

# When mulled_resolution_cache_type = ext:database, this is the
# database schema name of the table used by beaker for caching mulled
# resolution requests.
#mulled_resolution_cache_schema_name: null

# Configuration file for the object store If this is set and exists,
# it overrides any other objectstore settings.
# The value of this option will be resolved with respect to
# <config_dir>.
#object_store_config_file: object_store_conf.xml

# Specify where cache monitoring is driven for caching object stores
# such as S3, Azure, and iRODS. This option has no affect on disk
# object stores. For production instances, the cache should be
# monitored by external tools such as tmpwatch and this value should
# be set to 'external'. This will disable all cache monitoring in
# Galaxy. Alternatively, 'celery' can monitor caches using a periodic
# task or an 'inprocess' thread can be used - but this last option
# seriously limits Galaxy's ability to scale. The default of 'auto'
# will use 'celery' if 'enable_celery_tasks' is set to true or
# 'inprocess' otherwise. This option serves as the default for all
# object stores and can be overridden on a per object store basis (but
# don't - just setup tmpwatch for all relevant cache paths).
#object_store_cache_monitor_driver: auto

# For object store cache monitoring done by Galaxy, this is the
# interval between cache checking steps. This is used by both
# inprocess cache monitors (which we recommend you do not use) and by
# the celery task if it is configured (by setting enable_celery_tasks
# to true and not setting object_store_cache_monitor_driver to
# external).
#object_store_cache_monitor_interval: 600

# Default cache path for caching object stores if cache not configured
# for that object store entry.
# The value of this option will be resolved with respect to
# <cache_dir>.
#object_store_cache_path: object_store_cache

# Default cache size for caching object stores if cache not configured
# for that object store entry.
#object_store_cache_size: -1

# What Dataset attribute is used to reference files in an ObjectStore
# implementation, this can be 'uuid' or 'id'. The default will depend
# on how the object store is configured, starting with 20.05 Galaxy
Expand Down
10 changes: 10 additions & 0 deletions lib/galaxy/config/sample/tool_shed.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,16 @@ tool_shed:
# store this information.
#citation_cache_lock_dir: database/citations/lock

# Url to database used by beaker for citation related caching.
#citation_cache_url: null

# Database table used by beaker for citation related caching.
#citation_cache_table_name: beaker_cache

# Schema of database table used by beaker for citation related
# caching.
#citation_cache_schema_name: null

# Turn on logging of user actions to the database. Actions currently
# logged are grid views, tool searches, and use of "recently" used
# tools menu. The log_events and log_actions functionality will
Expand Down
Loading