You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2021/12/22 17:29:29 UTC
[superset] 01/04: feat: bypass cache on screenshots for alerts
This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch ch24621c
in repository https://gitbox.apache.org/repos/asf/superset.git
commit a80c3cda3172d1ebaaae45751e62efdc7420427f
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Wed Dec 8 17:14:34 2021 -0800
feat: bypass cache on screenshots for alerts
---
superset/reports/commands/execute.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/superset/reports/commands/execute.py b/superset/reports/commands/execute.py
index 687e05c..79f549a 100644
--- a/superset/reports/commands/execute.py
+++ b/superset/reports/commands/execute.py
@@ -95,7 +95,9 @@ class BaseReportState:
self._execution_id = execution_id
def set_state_and_log(
- self, state: ReportState, error_message: Optional[str] = None,
+ self,
+ state: ReportState,
+ error_message: Optional[str] = None,
) -> None:
"""
Updates current ReportSchedule state and TS. If on final state writes the log
@@ -104,7 +106,8 @@ class BaseReportState:
now_dttm = datetime.utcnow()
self.set_state(state, now_dttm)
self.create_log(
- state, error_message=error_message,
+ state,
+ error_message=error_message,
)
def set_state(self, state: ReportState, dttm: datetime) -> None:
@@ -146,8 +149,6 @@ class BaseReportState:
"""
Get the url for this report schedule: chart or dashboard
"""
- # For alerts we always want to send a fresh screenshot, bypassing
- # the cache.
force = "true" if self._report_schedule.force_screenshot else "false"
if self._report_schedule.chart:
@@ -520,12 +521,14 @@ class ReportWorkingState(BaseReportState):
if self.is_on_working_timeout():
exception_timeout = ReportScheduleWorkingTimeoutError()
self.set_state_and_log(
- ReportState.ERROR, error_message=str(exception_timeout),
+ ReportState.ERROR,
+ error_message=str(exception_timeout),
)
raise exception_timeout
exception_working = ReportSchedulePreviousWorkingError()
self.set_state_and_log(
- ReportState.WORKING, error_message=str(exception_working),
+ ReportState.WORKING,
+ error_message=str(exception_working),
)
raise exception_working