From 89794a6f89b3609dcf5972f6e1f01180f7d4f198 Mon Sep 17 00:00:00 2001 From: Rob DiCiuccio Date: Wed, 20 Jan 2021 10:48:32 -0800 Subject: [PATCH 1/2] Add deprecation notice to superset.tasks.schedules --- superset/tasks/schedules.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/superset/tasks/schedules.py b/superset/tasks/schedules.py index 62e084193088a..9aed752daa238 100644 --- a/superset/tasks/schedules.py +++ b/superset/tasks/schedules.py @@ -14,8 +14,11 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - -"""Utility functions used across Superset""" +""" +DEPRECATION NOTICE: this module is deprecated as of v1.0.0. +It will be removed in future versions of Superset. Please +migrate to the new scheduler: `superset.tasks.scheduler`. +""" import logging import time From 5223f0d25d314ac61bd7af2d6eef9028956a57d6 Mon Sep 17 00:00:00 2001 From: Rob DiCiuccio Date: Wed, 20 Jan 2021 10:49:23 -0800 Subject: [PATCH 2/2] Reduce retries and schedule window for alerts --- superset/tasks/schedules.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/superset/tasks/schedules.py b/superset/tasks/schedules.py index 9aed752daa238..c6e8e96df7e09 100644 --- a/superset/tasks/schedules.py +++ b/superset/tasks/schedules.py @@ -538,11 +538,10 @@ def schedule_email_report( @celery_app.task( name="alerts.run_query", bind=True, - soft_time_limit=config["EMAIL_ASYNC_TIME_LIMIT_SEC"], # TODO: find cause of https://github.com/apache/superset/issues/10530 # and remove retry autoretry_for=(NoSuchColumnError, ResourceClosedError,), - retry_kwargs={"max_retries": 5}, + retry_kwargs={"max_retries": 1}, retry_backoff=True, ) def schedule_alert_query( @@ -847,8 +846,8 @@ def schedule_alerts() -> None: resolution = 0 now = datetime.utcnow() start_at = now - timedelta( - seconds=3600 - ) # process any missed tasks in the past hour + seconds=300 + ) # process any missed tasks in the past few minutes stop_at = now + timedelta(seconds=1) with session_scope(nullpool=True) as session: schedule_window(ScheduleType.alert, start_at, stop_at, resolution, session)