Эх сурвалжийг харах

HUE-8725 [core] Add configuration for Celery Beat

Romain Rigaux 6 жил өмнө
parent
commit
9b9caecb4b

+ 3 - 0
desktop/conf.dist/hue.ini

@@ -795,6 +795,9 @@
    # Default options provided to the task server at startup.
    ## celeryd_opts='--time-limit=300'
 
+   # Switch on the integration with the Task Scheduler.
+   ## beat_enabled=False
+
 
 ###########################################################################
 # Settings to configure the snippets available in the Notebook

+ 3 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -797,6 +797,9 @@
    # Default options provided to the task server at startup.
    ## celeryd_opts='--time-limit=300'
 
+   # Switch on the integration with the Task Scheduler.
+   ## beat_enabled=False
+
 
 ###########################################################################
 # Settings to configure the snippets available in the Notebook

+ 7 - 1
desktop/core/src/desktop/conf.py

@@ -1639,7 +1639,13 @@ TASK_SERVER = ConfigSection(
       key='celeryd_opts',
       default='--time-limit=300',
       help=_('Default options provided to the task server at startup.')
-    )
+    ),
+    BEAT_ENABLED= Config(
+      key='beat_enabled',
+      default=False,
+      type=coerce_bool,
+      help=_('Switch on the integration with the Task Scheduler.')
+    ),
 ))
 
 

+ 4 - 0
desktop/core/src/desktop/settings.py

@@ -206,6 +206,10 @@ INSTALLED_APPS = [
     #'django_celery_results',
 ]
 
+if desktop.conf.TASK_SERVER.BEAT_ENABLED.get():
+  INSTALLED_APPS.append('django_celery_beat')
+
+
 WEBPACK_LOADER = {
     'DEFAULT': {
         'BUNDLE_DIR_NAME': 'desktop/js/bundles/',

+ 11 - 0
docs/admin-manual/manual.md

@@ -270,6 +270,17 @@ debug_task.delay().get() # Works if result backend is setup and task_server is t
 
 ```
 
+Starting the Task Scheduler server:
+
+```
+./build/env/bin/celery -A core beat -l info
+```
+
+or when Django Celery Beat is enabled:
+
+```
+./build/env/bin/celery -A core beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
+```
 
 ### Proxy