Skip to content

Commit

Permalink
removed error text from header_data
Browse files Browse the repository at this point in the history
  • Loading branch information
AAfghahi committed Oct 28, 2022
1 parent d29ee8c commit 998e1e0
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 13 deletions.
10 changes: 0 additions & 10 deletions superset/reports/commands/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# under the License.
import json
import logging
import re
from datetime import datetime, timedelta
from typing import Any, List, Optional, Union
from uuid import UUID
Expand Down Expand Up @@ -323,7 +322,6 @@ def _get_log_data(self) -> HeaderDataType:
"chart_id": chart_id,
"dashboard_id": dashboard_id,
"owners": self._report_schedule.owners,
"error_text": None,
}
return log_data

Expand Down Expand Up @@ -355,7 +353,6 @@ def _get_notification_content(self) -> NotificationContent:
if not csv_data:
error_text = "Unexpected missing csv file"
if error_text:
header_data["error_text"] = error_text
return NotificationContent(
name=self._report_schedule.name,
text=error_text,
Expand Down Expand Up @@ -435,13 +432,6 @@ def send_error(self, name: str, message: str) -> None:
:raises: NotificationError
"""
header_data = self._get_log_data()
error_parsing = re.search("Query Job SQL Follows", message)
if error_parsing:
error_index = error_parsing.span()
new_message = message[: error_index[0]]
header_data["error_text"] = new_message
else:
header_data["error_text"] = message
logger.info(
"header_data in notifications for alerts and reports %s, taskid, %s",
header_data,
Expand Down
1 change: 0 additions & 1 deletion superset/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ class HeaderDataType(TypedDict):
notification_source: Optional[str]
chart_id: Optional[int]
dashboard_id: Optional[int]
error_text: Optional[str]


class DatasourceDict(TypedDict):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ def test_report_with_header_data(
assert header_data.get("notification_format") == report_schedule.report_format
assert header_data.get("notification_source") == ReportSourceFormat.DASHBOARD
assert header_data.get("notification_type") == report_schedule.type
assert len(send_email_smtp_mock.call_args.kwargs["header_data"]) == 7
assert len(send_email_smtp_mock.call_args.kwargs["header_data"]) == 6
1 change: 0 additions & 1 deletion tests/unit_tests/notifications/email_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def test_render_description_with_html() -> None:
"notification_source": None,
"chart_id": None,
"dashboard_id": None,
"error_text": None,
},
)
email_body = (
Expand Down

0 comments on commit 998e1e0

Please sign in to comment.