You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by dp...@apache.org on 2021/03/05 09:40:53 UTC

[superset] branch master updated: docs: deprecate old alerts and dash/charts reports (#13440)

This is an automated email from the ASF dual-hosted git repository.

dpgaspar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 94fc5d5  docs: deprecate old alerts and dash/charts reports (#13440)
94fc5d5 is described below

commit 94fc5d586e225e569250d16f7b1efc3b619af78c
Author: Daniel Vaz Gaspar <da...@gmail.com>
AuthorDate: Fri Mar 5 09:40:08 2021 +0000

    docs: deprecate old alerts and dash/charts reports (#13440)
    
    * docs: deprecated old alerts and dash/charts reports
    
    * revert celery default config
    
    * fix lint
---
 UPDATING.md                                        |  7 ++++
 .../src/pages/docs/installation/alerts_reports.mdx |  2 +-
 superset/app.py                                    |  7 ++++
 superset/config.py                                 | 27 +++++++++++----
 superset/tasks/slack_util.py                       |  3 ++
 superset/views/alerts.py                           | 24 +++++++++++--
 superset/views/schedules.py                        | 40 +++++++++++++++++++++-
 7 files changed, 100 insertions(+), 10 deletions(-)

diff --git a/UPDATING.md b/UPDATING.md
index 18f6e80..c9dfb1d 100644
--- a/UPDATING.md
+++ b/UPDATING.md
@@ -26,6 +26,13 @@ assists people when migrating to a new version.
 ### Breaking Changes
 ### Potential Downtime
 ### Deprecations
+- [11509](https://github.com/apache/superset/pull/12491): Dashboard/Charts reports and old Alerts is deprecated. The following config keys are deprecated:
+    - ENABLE_ALERTS
+    - SCHEDULED_EMAIL_DEBUG_MODE
+    - EMAIL_REPORTS_CRON_RESOLUTION
+    - EMAIL_ASYNC_TIME_LIMIT_SEC
+    - EMAIL_REPORT_BCC_ADDRESS
+    - EMAIL_REPORTS_USER
 ### Other
 
 [shillelagh](https://github.com/betodealmeida/shillelagh/) is now the recommended module to connect Superset to Google Spreadsheets, since it's more robust and has extensive test coverage. You should uninstall the `gsheetsdb` module and install the `shillelagh` module in its place. Shillelagh is a drop-in replacement, so no modifications are needed to be done on existing queries, datasets or charts.
diff --git a/docs/src/pages/docs/installation/alerts_reports.mdx b/docs/src/pages/docs/installation/alerts_reports.mdx
index a8a4e46..b6fa9b2 100644
--- a/docs/src/pages/docs/installation/alerts_reports.mdx
+++ b/docs/src/pages/docs/installation/alerts_reports.mdx
@@ -343,7 +343,7 @@ are not accessible to unauthorized requests, that is why the worker needs to tak
 of an existing user to take a snapshot.
 
 ```python
-EMAIL_REPORTS_USER = 'username_with_permission_to_access_dashboards'
+THUMBNAIL_SELENIUM_USER = 'username_with_permission_to_access_dashboards'
 ```
 
 **Important notes**
diff --git a/superset/app.py b/superset/app.py
index feaf0d8..432d3fb 100644
--- a/superset/app.py
+++ b/superset/app.py
@@ -412,6 +412,10 @@ class SupersetAppInitializer:
         # Conditionally setup email views
         #
         if self.config["ENABLE_SCHEDULED_EMAIL_REPORTS"]:
+            logging.warning(
+                "ENABLE_SCHEDULED_EMAIL_REPORTS "
+                "is deprecated and will be removed in version 2.0.0"
+            )
             appbuilder.add_separator("Manage")
             appbuilder.add_view(
                 DashboardEmailScheduleView,
@@ -431,6 +435,9 @@ class SupersetAppInitializer:
             )
 
         if self.config["ENABLE_ALERTS"]:
+            logging.warning(
+                "ENABLE_ALERTS is deprecated and will be removed in version 2.0.0"
+            )
             appbuilder.add_view(
                 AlertModelView,
                 "Alerts",
diff --git a/superset/config.py b/superset/config.py
index 622ff05..94abd64 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -424,6 +424,7 @@ EXTRA_SEQUENTIAL_COLOR_SCHEMES: List[Dict[str, Any]] = []
 
 # ---------------------------------------------------
 # Thumbnail config (behind feature flag)
+# Also used by Alerts & Reports
 # ---------------------------------------------------
 THUMBNAIL_SELENIUM_USER = "admin"
 THUMBNAIL_CACHE_CONFIG: CacheConfig = {
@@ -891,24 +892,35 @@ DB_CONNECTION_MUTATOR = None
 SQL_QUERY_MUTATOR = None
 
 # Enable / disable scheduled email reports
+#
+# Warning: This config key is deprecated and will be removed in version 2.0.0"
 ENABLE_SCHEDULED_EMAIL_REPORTS = False
 
 # Enable / disable Alerts, where users can define custom SQL that
 # will send emails with screenshots of charts or dashboards periodically
 # if it meets the criteria
+#
+# Warning: This config key is deprecated and will be removed in version 2.0.0"
 ENABLE_ALERTS = False
 
+# ---------------------------------------------------
+# Alerts & Reports
+# ---------------------------------------------------
 # Used for Alerts/Reports (Feature flask ALERT_REPORTS) to set the size for the
 # sliding cron window size, should be synced with the celery beat config minus 1 second
 ALERT_REPORTS_CRON_WINDOW_SIZE = 59
+# A custom prefix to use on all Alerts & Reports emails
+EMAIL_REPORTS_SUBJECT_PREFIX = "[Report] "
 
 # Slack API token for the superset reports
 SLACK_API_TOKEN = None
 SLACK_PROXY = None
 
-# If enabled, certail features are run in debug mode
+# If enabled, certain features are run in debug mode
 # Current list:
 # * Emails are sent using dry-run mode (logging only)
+#
+# Warning: This config key is deprecated and will be removed in version 2.0.0"
 SCHEDULED_EMAIL_DEBUG_MODE = False
 
 # This auth provider is used by background (offline) tasks that need to access
@@ -917,26 +929,29 @@ SCHEDULED_EMAIL_DEBUG_MODE = False
 MACHINE_AUTH_PROVIDER_CLASS = "superset.utils.machine_auth.MachineAuthProvider"
 
 # Email reports - minimum time resolution (in minutes) for the crontab
+#
+# Warning: This config key is deprecated and will be removed in version 2.0.0"
 EMAIL_REPORTS_CRON_RESOLUTION = 15
 
 # The MAX duration (in seconds) a email schedule can run for before being killed
 # by celery.
+#
+# Warning: This config key is deprecated and will be removed in version 2.0.0"
 EMAIL_ASYNC_TIME_LIMIT_SEC = 300
 
-# Email report configuration
-# From address in emails
-EMAIL_REPORT_FROM_ADDRESS = "reports@superset.org"
-
 # Send bcc of all reports to this address. Set to None to disable.
 # This is useful for maintaining an audit trail of all email deliveries.
+#
+# Warning: This config key is deprecated and will be removed in version 2.0.0"
 EMAIL_REPORT_BCC_ADDRESS = None
 
 # User credentials to use for generating reports
 # This user should have permissions to browse all the dashboards and
 # slices.
 # TODO: In the future, login as the owner of the item to generate reports
+#
+# Warning: This config key is deprecated and will be removed in version 2.0.0"
 EMAIL_REPORTS_USER = "admin"
-EMAIL_REPORTS_SUBJECT_PREFIX = "[Report] "
 
 # The webdriver to use for generating reports. Use one of the following
 # firefox
diff --git a/superset/tasks/slack_util.py b/superset/tasks/slack_util.py
index a646d7d..9cb8c91 100644
--- a/superset/tasks/slack_util.py
+++ b/superset/tasks/slack_util.py
@@ -14,6 +14,9 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+"""
+DEPRECATION NOTICE: this module is deprecated and will be removed on 2.0.
+"""
 import logging
 from io import IOBase
 from typing import cast, Optional, Union
diff --git a/superset/views/alerts.py b/superset/views/alerts.py
index a72fd67..46538de 100644
--- a/superset/views/alerts.py
+++ b/superset/views/alerts.py
@@ -14,8 +14,12 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+"""
+DEPRECATION NOTICE: this module is deprecated and will be removed on 2.0.
+"""
+
 from croniter import croniter
-from flask import abort
+from flask import abort, flash, Markup
 from flask_appbuilder import CompactCRUDMixin, permission_name
 from flask_appbuilder.api import expose
 from flask_appbuilder.models.sqla.interface import SQLAInterface
@@ -81,7 +85,6 @@ class BaseAlertReportView(BaseSupersetView):
             and is_feature_enabled("ALERT_REPORTS")
         ):
             return abort(404)
-
         return super().render_app_template()
 
     @expose("/<pk>/log/", methods=["GET"])
@@ -209,6 +212,23 @@ class AlertModelView(SupersetModelView):  # pylint: disable=too-many-ancestors
         AlertLogModelView,
     ]
 
+    @expose("/list/")
+    @has_access
+    def list(self) -> FlaskResponse:
+        flash(
+            Markup(
+                _(
+                    "This feature is deprecated and will be removed on 2.0. "
+                    "Take a look at the replacement feature "
+                    "<a href="
+                    "'https://superset.apache.org/docs/installation/alerts-reports'>"
+                    "Alerts & Reports documentation</a>"
+                )
+            ),
+            "warning",
+        )
+        return super().list()
+
     def pre_add(self, item: "AlertModelView") -> None:
         item.recipients = get_email_address_str(item.recipients)
 
diff --git a/superset/views/schedules.py b/superset/views/schedules.py
index d98c339..d463390 100644
--- a/superset/views/schedules.py
+++ b/superset/views/schedules.py
@@ -14,12 +14,16 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+"""
+DEPRECATION NOTICE: this module is deprecated and will be removed on 2.0.
+"""
+
 import enum
 from typing import Type, Union
 
 import simplejson as json
 from croniter import croniter
-from flask import flash, g
+from flask import flash, g, Markup
 from flask_appbuilder import expose
 from flask_appbuilder.models.sqla.interface import SQLAInterface
 from flask_appbuilder.security.decorators import has_access
@@ -232,6 +236,23 @@ class DashboardEmailScheduleView(
         "delivery_type": _("Delivery Type"),
     }
 
+    @expose("/list/")
+    @has_access
+    def list(self) -> FlaskResponse:
+        flash(
+            Markup(
+                _(
+                    "This feature is deprecated and will be removed on 2.0. "
+                    "Take a look at the replacement feature "
+                    "<a href="
+                    "'https://superset.apache.org/docs/installation/alerts-reports'>"
+                    "Alerts & Reports documentation</a>"
+                )
+            ),
+            "warning",
+        )
+        return super().list()
+
     def pre_add(self, item: "DashboardEmailScheduleView") -> None:
         if item.dashboard is None:
             raise SupersetException("Dashboard is mandatory")
@@ -296,6 +317,23 @@ class SliceEmailScheduleView(EmailScheduleView):  # pylint: disable=too-many-anc
         "email_format": _("Email Format"),
     }
 
+    @expose("/list/")
+    @has_access
+    def list(self) -> FlaskResponse:
+        flash(
+            Markup(
+                _(
+                    "This feature is deprecated and will be removed on 2.0. "
+                    "Take a look at the replacement feature "
+                    "<a href="
+                    "'https://superset.apache.org/docs/installation/alerts-reports'>"
+                    "Alerts & Reports documentation</a>"
+                )
+            ),
+            "warning",
+        )
+        return super().list()
+
     def pre_add(self, item: "SliceEmailScheduleView") -> None:
         if item.slice is None:
             raise SupersetException("Slice is mandatory")