You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2020/01/04 07:21:12 UTC
[incubator-superset] branch master updated: Add config for celery
email task soft time (#8887)
This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 478e445 Add config for celery email task soft time (#8887)
478e445 is described below
commit 478e445a5a52613b5e1b5e7c666946715d7e8506
Author: Hossein Torabi <ho...@alopeyk.com>
AuthorDate: Sat Jan 4 10:50:57 2020 +0330
Add config for celery email task soft time (#8887)
---
superset/config.py | 4 ++++
superset/tasks/schedules.py | 6 +++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/superset/config.py b/superset/config.py
index c9cc252..9466208 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -651,6 +651,10 @@ SCHEDULED_EMAIL_DEBUG_MODE = False
# Email reports - minimum time resolution (in minutes) for the crontab
EMAIL_REPORTS_CRON_RESOLUTION = 15
+# The MAX duration (in seconds) a email schedule can run for before being killed
+# by celery.
+EMAIL_ASYNC_TIME_LIMIT_SEC = 300
+
# Email report configuration
# From address in emails
EMAIL_REPORT_FROM_ADDRESS = "reports@superset.org"
diff --git a/superset/tasks/schedules.py b/superset/tasks/schedules.py
index 59696ef..de7ba5a 100644
--- a/superset/tasks/schedules.py
+++ b/superset/tasks/schedules.py
@@ -346,7 +346,11 @@ def deliver_slice(schedule):
_deliver_email(schedule, subject, email)
-@celery_app.task(name="email_reports.send", bind=True, soft_time_limit=300)
+@celery_app.task(
+ name="email_reports.send",
+ bind=True,
+ soft_time_limit=config["EMAIL_ASYNC_TIME_LIMIT_SEC"],
+)
def schedule_email_report(
task, report_type, schedule_id, recipients=None
): # pylint: disable=unused-argument