Skip to content

Commit

Permalink
Revert "fix: Ensure alerts & reports aren't schduled when flag is off (
Browse files Browse the repository at this point in the history
…apache#16639)"

This reverts commit 4dc859f.
  • Loading branch information
Steven Uray committed Sep 22, 2021
1 parent 4f7f5f3 commit d96b7ad
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
4 changes: 1 addition & 3 deletions superset/tasks/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from celery.exceptions import SoftTimeLimitExceeded
from dateutil import parser

from superset import app, is_feature_enabled
from superset import app
from superset.commands.exceptions import CommandException
from superset.extensions import celery_app
from superset.reports.commands.exceptions import ReportScheduleUnexpectedError
Expand All @@ -37,8 +37,6 @@ def scheduler() -> None:
"""
Celery beat main scheduler for reports
"""
if not is_feature_enabled("ALERT_REPORTS"):
return
with session_scope(nullpool=True) as session:
active_schedules = ReportScheduleDAO.find_active(session)
for active_schedule in active_schedules:
Expand Down
22 changes: 0 additions & 22 deletions tests/integration_tests/reports/scheduler_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,25 +115,3 @@ def test_scheduler_celery_no_timeout_utc(execute_mock):
db.session.delete(report_schedule)
db.session.commit()
app.config["ALERT_REPORTS_WORKING_TIME_OUT_KILL"] = True


@patch("superset.tasks.scheduler.is_feature_enabled")
@patch("superset.tasks.scheduler.execute.apply_async")
def test_scheduler_feature_flag_off(execute_mock, is_feature_enabled):
"""
Reports scheduler: Test scheduler with feature flag off
"""
with app.app_context():
is_feature_enabled.return_value = False
report_schedule = insert_report_schedule(
type=ReportScheduleType.ALERT,
name="report",
crontab="0 9 * * *",
timezone="UTC",
)

with freeze_time("2020-01-01T09:00:00Z"):
scheduler()
execute_mock.assert_not_called()
db.session.delete(report_schedule)
db.session.commit()

0 comments on commit d96b7ad

Please sign in to comment.