Skip to content

Commit

Permalink
chore: remove old alerts and configs keys (#19261)
Browse files Browse the repository at this point in the history
* remove templates

* remove models and more templates

* remove view

* remove tasks

* remove views

* remove schedule models

* remove views, init files config code

* remove supersetapp init code

* remove tests and clean up pylint errors

* remove unused import

* pylint

* run black

* remove deprecate notice
  • Loading branch information
pkdotson committed Mar 25, 2022
1 parent 2b53578 commit 394c9a1
Show file tree
Hide file tree
Showing 16 changed files with 6 additions and 3,020 deletions.
22 changes: 0 additions & 22 deletions superset/cli/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
# specific language governing permissions and limitations
# under the License.
import logging
from datetime import datetime, timedelta

import click
from colorama import Fore
from flask.cli import with_appcontext

import superset.utils.database as database_utils
from superset import app, security_manager
from superset.utils.celery import session_scope

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -88,23 +86,3 @@ def load_test_users_run() -> None:
password="general",
)
sm.get_session.commit()


@click.command()
@with_appcontext
def alert() -> None:
"""Run the alert scheduler loop"""
# this command is just for testing purposes
# pylint: disable=import-outside-toplevel
from superset.models.schedules import ScheduleType
from superset.tasks.schedules import schedule_window

click.secho("Processing one alert loop", fg="green")
with session_scope(nullpool=True) as session:
schedule_window(
report_type=ScheduleType.alert,
start_at=datetime.now() - timedelta(1000),
stop_at=datetime.now(),
resolution=6000,
session=session,
)
12 changes: 0 additions & 12 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,18 +1051,6 @@ def SQL_QUERY_MUTATOR( # pylint: disable=invalid-name,unused-argument
return sql


# 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
# ---------------------------------------------------
Expand Down
57 changes: 1 addition & 56 deletions superset/initialization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,7 @@ def init_views(self) -> None:
from superset.reports.logs.api import ReportExecutionLogRestApi
from superset.security.api import SecurityRestApi
from superset.views.access_requests import AccessRequestsModelView
from superset.views.alerts import (
AlertLogModelView,
AlertModelView,
AlertObservationModelView,
AlertView,
ReportView,
)
from superset.views.alerts import AlertView
from superset.views.annotations import (
AnnotationLayerModelView,
AnnotationModelView,
Expand Down Expand Up @@ -185,10 +179,6 @@ def init_views(self) -> None:
from superset.views.log.api import LogRestApi
from superset.views.log.views import LogModelView
from superset.views.redirects import R
from superset.views.schedules import (
DashboardEmailScheduleView,
SliceEmailScheduleView,
)
from superset.views.sql_lab import (
SavedQueryView,
SavedQueryViewApi,
Expand Down Expand Up @@ -393,50 +383,6 @@ def init_views(self) -> None:
#
# 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", cond=lambda: self.config["ENABLE_SCHEDULED_EMAIL_REPORTS"]
)
appbuilder.add_view(
DashboardEmailScheduleView,
"Dashboard Email Schedules",
label=__("Dashboard Emails"),
category="Manage",
category_label=__("Manage"),
icon="fa-search",
menu_cond=lambda: self.config["ENABLE_SCHEDULED_EMAIL_REPORTS"],
)
appbuilder.add_view(
SliceEmailScheduleView,
"Chart Emails",
label=__("Chart Email Schedules"),
category="Manage",
category_label=__("Manage"),
icon="fa-search",
menu_cond=lambda: self.config["ENABLE_SCHEDULED_EMAIL_REPORTS"],
)

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",
label=__("Alerts"),
category="Manage",
category_label=__("Manage"),
icon="fa-exclamation-triangle",
menu_cond=lambda: bool(self.config["ENABLE_ALERTS"]),
)
appbuilder.add_view_no_menu(AlertLogModelView)
appbuilder.add_view_no_menu(AlertObservationModelView)

appbuilder.add_view(
AlertView,
Expand All @@ -447,7 +393,6 @@ def init_views(self) -> None:
icon="fa-exclamation-triangle",
menu_cond=lambda: feature_flag_manager.is_feature_enabled("ALERT_REPORTS"),
)
appbuilder.add_view_no_menu(ReportView)

appbuilder.add_view(
AccessRequestsModelView,
Expand Down
10 changes: 1 addition & 9 deletions superset/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,4 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from . import (
alerts,
core,
datasource_access_request,
dynamic_plugins,
schedules,
sql_lab,
user_attributes,
)
from . import core, datasource_access_request, dynamic_plugins, sql_lab, user_attributes
176 changes: 0 additions & 176 deletions superset/models/alerts.py

This file was deleted.

0 comments on commit 394c9a1

Please sign in to comment.