bito-code-review[bot] commented on code in PR #40885:
URL: https://github.com/apache/superset/pull/40885#discussion_r3379000821


##########
superset/commands/report/execute.py:
##########
@@ -552,6 +567,19 @@ def _get_csv_data(self) -> bytes:
             raise ReportScheduleCsvFailedError()
         return csv_data
 
+    def _get_xlsx_data(self) -> bytes:
+        try:
+            xlsx_data = self._get_chart_data(ChartDataResultFormat.XLSX)
+        except SoftTimeLimitExceeded as ex:
+            raise ReportScheduleXlsxTimeout() from ex
+        except Exception as ex:
+            raise ReportScheduleXlsxFailedError(
+                f"Failed generating xlsx {str(ex)}"
+            ) from ex
+        if not xlsx_data:
+            raise ReportScheduleXlsxFailedError()
+        return xlsx_data

Review Comment:
   <!-- Bito Reply -->
   The suggestion is appropriate and improves the code by adding diagnostic 
logging for timeouts, which aligns with the existing logging pattern in the 
codebase. Applying this change will help in troubleshooting production issues 
by providing visibility into the duration of XLSX generation timeouts.
   
   **superset/commands/report/execute.py**
   ```
   start_time = datetime.utcnow()
               xlsx_data = self._get_chart_data(ChartDataResultFormat.XLSX)
           except SoftTimeLimitExceeded as ex:
               elapsed_seconds = (datetime.utcnow() - 
start_time).total_seconds()
               logger.warning(
                   "XLSX generation timeout after %.2fs - execution_id: %s",
                   elapsed_seconds,
                   self._execution_id,
               )
               raise ReportScheduleXlsxTimeout() from 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