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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to