This is an automated email from the ASF dual-hosted git repository.

aafghahi pushed a commit to branch arashPhillip/fixError
in repository https://gitbox.apache.org/repos/asf/superset.git

commit d29ee8ce6e285f424dc951b818a584809f669909
Author: AAfghahi <[email protected]>
AuthorDate: Wed Oct 26 17:51:59 2022 -0400

    error_parsing
---
 superset/reports/commands/execute.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/superset/reports/commands/execute.py 
b/superset/reports/commands/execute.py
index 41efb4821d..a645e974ea 100644
--- a/superset/reports/commands/execute.py
+++ b/superset/reports/commands/execute.py
@@ -16,6 +16,7 @@
 # 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
@@ -434,7 +435,13 @@ class BaseReportState:
         :raises: NotificationError
         """
         header_data = self._get_log_data()
-        header_data["error_text"] = message
+        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,

Reply via email to