From 9586463772b784bde33e74afac1929abd4414ac8 Mon Sep 17 00:00:00 2001 From: Marina Samuel Date: Fri, 27 Apr 2018 10:31:01 -0400 Subject: [PATCH] Add data source health monitoring via an extension. Refs: #379, #415 --- redash/monitor.py | 2 +- redash/worker.py | 7 +++++++ requirements.txt | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/redash/monitor.py b/redash/monitor.py index f1f241eb26..41fdc0ddb5 100644 --- a/redash/monitor.py +++ b/redash/monitor.py @@ -35,7 +35,7 @@ def get_queues_status(): 'data_sources': ', '.join(sources), 'size': redis_connection.llen(queue) } - + queues['celery'] = { 'size': redis_connection.llen('celery'), 'data_sources': '' diff --git a/redash/worker.py b/redash/worker.py index 48b1aea0c9..2ca403bf98 100644 --- a/redash/worker.py +++ b/redash/worker.py @@ -79,3 +79,10 @@ def __call__(self, *args, **kwargs): def init_celery_flask_app(**kwargs): app = create_app() app.app_context().push() + +@celery.on_after_configure.connect +def add_periodic_tasks(sender, **kwargs): + app = create_app() + periodic_tasks = getattr(app, 'periodic_tasks', {}) + for params in periodic_tasks.values(): + sender.add_periodic_task(**params) diff --git a/requirements.txt b/requirements.txt index 2b8c2d535a..04ec666800 100644 --- a/requirements.txt +++ b/requirements.txt @@ -55,4 +55,4 @@ disposable-email-domains # Uncomment the requirement for ldap3 if using ldap. # It is not included by default because of the GPL license conflict. # ldap3==2.2.4 -redash-stmo>=2018.4.0 +redash-stmo>=2018.8.1