apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
61.91k stars 13.57k forks source link

Error loading Alerts & reports page after saving CRON schedule with step values #13392

Closed eohulse closed 2 years ago

eohulse commented 3 years ago

Some CRON schedules when saved in the database cannot be read back. For example, when scheduling a report to be sent every day at 20:00, 20:05, and 20:10 (CRON 0-10/5 20 *), one can save this to the database. However when the Alerts & reports page is reloaded the page does not load any report, and an error appear in the log indicating 10/5 cannot be handled.

Expected results

Since I generated the CRON using the UI, superset should be able to read them back from the database.

Actual results

No reports can be loaded or created anymore. The whole alert/reporting functionality seemed to be broken because o f the error.

Screenshots

Screenshot from 2021-03-01 22-15-22

How to reproduce the bug

  1. Set up a docker enabling reports/alerts using postgres. (Followed this template
  2. Go to Settings > Alerts & reports > Reports
  3. Click on '+ REPORT'
  4. Set up a report to be sent, but use the following CRON: 0-10/5 20 *
  5. Save the report
  6. Go to the superset home page
  7. Go back to the Alerts & reports page, the new report that was recently created is not listed (empty list)

Environment

(please complete the following information):

lizheng404 commented 2 years ago

i have the same issue

screenshots

FA246C01-1021-4aa8-9EB0-0D8079F69704

CRON : 30-50/10 8 *

When I click add, an error is prompted

image

Error log

2021-11-10 15:07:17,679:ERROR:root:An error occured when generating the expression description. Check the cron expression syntax. Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/cron_descriptor/ExpressionDescriptor.py", line 125, in get_full_description time_segment = self.get_time_of_day_description() File "/usr/local/lib/python3.8/site-packages/cron_descriptor/ExpressionDescriptor.py", line 181, in get_time_of_day_description self.format_time(hour_expression, minute_parts[0]), self.format_time(hour_expression, minute_parts[1]))) File "/usr/local/lib/python3.8/site-packages/cron_descriptor/ExpressionDescriptor.py", line 534, in format_time minute = str(int(minute_expression)) # !FIXME WUT ??? ValueError: invalid literal for int() with base 10: '50/10'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/init.py", line 85, in wraps return f(self, *args, kwargs) File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/init.py", line 155, in wraps return f(self, args, kwargs) File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/init.py", line 1592, in get_list return self.get_list_headless(kwargs) File "/usr/local/lib/python3.8/site-packages/superset/utils/log.py", line 241, in wrapper value = f(args, kwargs) File "/usr/local/lib/python3.8/site-packages/superset/views/base_api.py", line 406, in get_list_headless duration, response = time_function(super().get_list_headless, *kwargs) File "/usr/local/lib/python3.8/site-packages/superset/utils/core.py", line 1429, in time_function response = func(args, kwargs) File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/api/init.py", line 1494, in get_list_headless _response[API_RESULT_RES_KEY] = _list_model_schema.dump(lst, many=True) File "/usr/local/lib/python3.8/site-packages/marshmallow/schema.py", line 552, in dump result = self._serialize(processed_obj, many=many) File "/usr/local/lib/python3.8/site-packages/marshmallow/schema.py", line 514, in _serialize return [ File "/usr/local/lib/python3.8/site-packages/marshmallow/schema.py", line 515, in self._serialize(d, many=False) File "/usr/local/lib/python3.8/site-packages/marshmallow/schema.py", line 520, in _serialize value = field_obj.serialize(attr_name, obj, accessor=self.get_attribute) File "/usr/local/lib/python3.8/site-packages/marshmallow/fields.py", line 339, in serialize return self._serialize(value, attr, obj, kwargs) File "/usr/local/lib/python3.8/site-packages/marshmallow/fields.py", line 1925, in _serialize return self._call_or_raise(self.serialize_func, obj, attr) File "/usr/local/lib/python3.8/site-packages/marshmallow/fields.py", line 1939, in _call_or_raise return func(value) File "/usr/local/lib/python3.8/site-packages/superset/models/reports.py", line 153, in crontab_humanized return get_description(self.crontab) File "/usr/local/lib/python3.8/site-packages/cron_descriptor/ExpressionDescriptor.py", line 615, in get_description return descripter.get_description(DescriptionTypeEnum.FULL) File "/usr/local/lib/python3.8/site-packages/cron_descriptor/ExpressionDescriptor.py", line 105, in get_description description = choices.get(description_type, self.get_seconds_description)() File "/usr/local/lib/python3.8/site-packages/cron_descriptor/ExpressionDescriptor.py", line 147, in get_full_description raise FormatException(description) cron_descriptor.Exception.FormatException: An error occured when generating the expression description. Check the cron expression syntax.

zuzana-vej commented 2 years ago

@eohulse there has been lot of fixes / improvements to the alert/report features. If you are still facing the same error on latest version please reopen or file new ticket. Thanks!