bito-code-review[bot] commented on PR #41096:
URL: https://github.com/apache/superset/pull/41096#issuecomment-4713650104
<!-- Bito Reply -->
The flagged issue is correct. Calling `get_dashboard_urls()` outside the
state machine's transaction without error handling means that any failure
(e.g., database errors, access issues) will raise an exception that aborts the
entire `run()` method, bypassing the state machine's built-in error logging and
notification mechanisms.
To resolve this, wrap the prewarm call in a `try-except` block that logs the
error and transitions the report state to an error status, ensuring consistent
failure handling. Here is the minimal fix:
```python
with override_user(user):
if self._model.dashboard_id:
try:
BaseReportState(
self._model, self._scheduled_dttm,
self._execution_id
).get_dashboard_urls()
except Exception as ex:
logger.exception("Failed to prewarm permalink")
self.set_state_error(str(ex))
return
```
There are no other comments on this PR to address.
**superset/commands/report/execute.py**
```
if self._model.dashboard_id:
try:
BaseReportState(
self._model, self._scheduled_dttm,
self._execution_id
).get_dashboard_urls()
except Exception as ex:
logger.exception("Failed to prewarm permalink")
self.set_state_error(str(ex))
return
```
--
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]