Make sure data_dir is used for default result backend DB

This commit is contained in:
davelopez
2024-04-10 15:27:13 +02:00
parent 9d9630dc1c
commit ac526184e8
4 changed files with 23 additions and 8 deletions
+4 -3
View File
@@ -5154,9 +5154,10 @@
only if you have setup a Celery worker for Galaxy and you have
configured the `celery_conf` option below. Specifically, you need
to set the `result_backend` option in the `celery_conf` option to
a valid Celery result backend URL. By default a SQLite database is
used for storing task results, please use a more robust backend
for production setups like Redis. For details, see
a valid Celery result backend URL. By default, Galaxy uses an
SQLite database at '<data_dir>/results.sqlite' for storing task
results. Please use a more robust backend for production setups
like Redis. For details, see
https://docs.galaxyproject.org/en/master/admin/production.html#use-celery-for-asynchronous-tasks
:Default: ``false``
:Type: bool
+13
View File
@@ -1082,6 +1082,9 @@ class GalaxyAppConfiguration(BaseAppConfiguration, CommonConfigurationMixin):
self.amqp_internal_connection = (
f"sqlalchemy+sqlite:///{self._in_data_dir('control.sqlite')}?isolation_level=IMMEDIATE"
)
self._process_celery_config()
self.pretty_datetime_format = expand_pretty_datetime_format(self.pretty_datetime_format)
try:
with open(self.user_preferences_extra_conf_path) as stream:
@@ -1203,6 +1206,16 @@ class GalaxyAppConfiguration(BaseAppConfiguration, CommonConfigurationMixin):
else:
_load_theme(self.themes_config_file, self.themes)
def _process_celery_config(self):
if self.celery_conf:
result_backend = self.celery_conf.get("result_backend")
if result_backend:
# If the result_backend is the default SQLite database, we need to
# ensure that the correct data directory is used.
if "results.sqlite" in result_backend:
result_backend = f"db+sqlite:///{self._in_data_dir('results.sqlite')}?isolation_level=IMMEDIATE"
self.celery_conf["result_backend"] = result_backend
def _check_database_connection_strings(self):
"""
Verify connection URI strings in galaxy's configuration are parseable with urllib.
+4 -3
View File
@@ -2761,9 +2761,10 @@ galaxy:
# only if you have setup a Celery worker for Galaxy and you have
# configured the `celery_conf` option below. Specifically, you need to
# set the `result_backend` option in the `celery_conf` option to a
# valid Celery result backend URL. By default a SQLite database is
# used for storing task results, please use a more robust backend for
# production setups like Redis. For details, see
# valid Celery result backend URL. By default, Galaxy uses an SQLite
# database at '<data_dir>/results.sqlite' for storing task results.
# Please use a more robust backend for production setups like Redis.
# For details, see
# https://docs.galaxyproject.org/en/master/admin/production.html#use-celery-for-asynchronous-tasks
#enable_celery_tasks: false
+2 -2
View File
@@ -3764,8 +3764,8 @@ mapping:
Activate this only if you have setup a Celery worker for Galaxy and you have
configured the `celery_conf` option below. Specifically, you need to set the
`result_backend` option in the `celery_conf` option to a valid Celery result
backend URL. By default a SQLite database is used for storing task results, please
use a more robust backend for production setups like Redis.
backend URL. By default, Galaxy uses an SQLite database at '<data_dir>/results.sqlite' for storing task results.
Please use a more robust backend for production setups like Redis.
For details, see https://docs.galaxyproject.org/en/master/admin/production.html#use-celery-for-asynchronous-tasks
celery_conf: