You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/09/02 07:17:52 UTC
[GitHub] [superset] randalee edited a comment on issue #13430: New alerts: Grace period does not work as expected
randalee edited a comment on issue #13430:
URL: https://github.com/apache/superset/issues/13430#issuecomment-911208144
Hi. @anilvpatel21 I faced the same problem as you.
I couldn't retrieve the discussion about the related issues, so we checked the code and fixed it.
https://github.com/apache/superset/blob/master/superset/reports/commands/execute.py#L548
If you remove the "return" of the line, you can send the alarm as desired.
You should also ensure that the status is not changed to SUCCESS. Otherwise, the alarm will be sent continuously after the initial trigger, even if the condition is not met.
Finally, the next function is shown below:
```.python
def next(self) -> None:
self.set_state_and_log(ReportState.WORKING)
if self._report_schedule.type == ReportScheduleType.ALERT:
if self.is_in_grace_period():
self.set_state_and_log(
ReportState.GRACE,
error_message=str(ReportScheduleAlertGracePeriodError()),
)
return
self.set_state_and_log(
ReportState.NOOP,
error_message=str(ReportScheduleAlertEndGracePeriodError()),
)
# return # remove return
try:
self.send() # real send
if self._report_schedule.type != ReportScheduleType.ALERT: # ALERT ReportState no change
self.set_state_and_log(ReportState.SUCCESS)
except CommandException as ex:
self.set_state_and_log(ReportState.ERROR, error_message=str(ex))
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org