mikebridge commented on code in PR #45099:
URL: https://github.com/apache/superset/pull/45099#discussion_r4224725530
##########
superset/commands/report/execute.py:
##########
@@ -1361,28 +1371,49 @@ def _get_embedded_data(self) -> pd.DataFrame:
"""
start_time: datetime = datetime.now(timezone.utc).replace(tzinfo=None)
- url = self._get_url(result_format=ChartDataResultFormat.JSON)
+ url: str = self._get_url(result_format=ChartDataResultFormat.JSON)
user, username = resolve_executor_user(self._report_schedule)
auth_cookies =
machine_auth_provider_factory.instance.get_auth_cookies(user)
if self._report_schedule.chart.query_context is None:
logger.warning("No query context found, taking a screenshot to
generate it")
self._update_query_context()
+ db.session.refresh(self._report_schedule.chart)
try:
- dataframe = get_chart_dataframe(
- url,
- auth_cookies,
- timeout=self._phase_timeout(
- "dataframe_generation",
-
requested_seconds=app.config["ALERT_REPORTS_CSV_REQUEST_TIMEOUT"],
- reserve_seconds=(
-
self._report_execution_context.post_capture_reserve_seconds
- if self._report_execution_context
- else 0.0
- ),
+ timeout: float | None = self._phase_timeout(
+ "dataframe_generation",
+
requested_seconds=app.config["ALERT_REPORTS_CSV_REQUEST_TIMEOUT"],
+ reserve_seconds=(
+ self._report_execution_context.post_capture_reserve_seconds
+ if self._report_execution_context
+ else 0.0
),
)
+ dataframe: pd.DataFrame | None
+ if self._report_schedule.chart.query_context is None:
+ dataframe = get_chart_dataframe(url, auth_cookies,
timeout=timeout)
+ else:
+ # Match the GET endpoint's current chart settings for client
processing.
+ form_data: dict[str, Any]
+ try:
+ form_data = json.loads(self._report_schedule.chart.params)
+ except (TypeError, json.JSONDecodeError):
+ form_data = {}
+ if not isinstance(form_data, dict):
+ form_data = {}
+ request_payload: dict[str, Any] =
self._get_chart_data_request_payload(
+ ChartDataResultFormat.JSON, form_data=form_data
+ )
+ url = get_url_path("ChartDataRestApi.data")
+ dataframe = chart_data_to_dataframe(
+ self._post_chart_data(
+ chart_url=url,
+ auth_cookies=auth_cookies,
+ request_payload=request_payload,
+ timeout=timeout,
+ )
+ )
Review Comment:
Thanks. This is an existing difference from the attachment path rather than
a regression: the previous embedded GET called `get_chart_dataframe` →
`get_chart_csv_data` directly, without `request_chart_data`, so it didn't retry
either. This change keeps that single-attempt behavior. Retry alignment belongs
in a separate change with per-attempt execution-budget tests.
--
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]