Add enable_celery_tasks config option

This commit is contained in:
mvdbeek
2021-03-29 09:29:25 -04:00
committed by Dannon Baker
parent 659651e3d8
commit 8bda8d4110
4 changed files with 32 additions and 3 deletions
+12
View File
@@ -4360,6 +4360,18 @@
:Type: str
~~~~~~~~~~~~~~~~~~~~~~~
``enable_celery_tasks``
~~~~~~~~~~~~~~~~~~~~~~~
:Description:
Offload long-running tasks to a Celery task queue. Activate this
only if you have setup a Celery worker for Galaxy. For details,
see https://docs.galaxyproject.org/en/master/admin/production.html
:Default: ``false``
:Type: bool
~~~~~~~~~~~~~~
``use_pbkdf2``
~~~~~~~~~~~~~~
@@ -2159,6 +2159,11 @@ galaxy:
# commented out line below).
#amqp_internal_connection: sqlalchemy+sqlite:///./database/control.sqlite?isolation_level=IMMEDIATE
# Offload long-running tasks to a Celery task queue. Activate this
# only if you have setup a Celery worker for Galaxy. For details, see
# https://docs.galaxyproject.org/en/master/admin/production.html
#enable_celery_tasks: false
# Allow disabling pbkdf2 hashing of passwords for legacy situations.
# This should normally be left enabled unless there is a specific
# reason to disable it.
@@ -3183,6 +3183,15 @@ mapping:
will automatically create and use a separate sqlite database located in your
<galaxy>/database folder (indicated in the commented out line below).
enable_celery_tasks:
type: bool
default: false
required: false
desc: |
Offload long-running tasks to a Celery task queue.
Activate this only if you have setup a Celery worker for Galaxy.
For details, see https://docs.galaxyproject.org/en/master/admin/production.html
use_pbkdf2:
type: bool
default: true
@@ -222,9 +222,12 @@ class User(BaseUIController, UsesFormDefinitionsMixin, CreatesApiKeysMixin):
if message:
return self.message_exception(trans, message)
if trans.user:
# Queue a quota recalculation (async) task -- this takes a
# while sometimes, so we don't want to block on logout.
recalculate_user_disk_usage.delay(user_id=trans.user.id)
if trans.app.config.enable_celery_tasks:
# Queue a quota recalculation (async) task -- this takes a
# while sometimes, so we don't want to block on logout.
recalculate_user_disk_usage.delay(user_id=trans.user.id)
else:
trans.user.calculate_and_set_disk_usage()
# Since logging an event requires a session, we'll log prior to ending the session
trans.log_event("User logged out")
trans.handle_user_logout(logout_all=logout_all)