villebro opened a new pull request, #43429:
URL: https://github.com/apache/superset/pull/43429

   ### SUMMARY
   
   **Step 5 of the GAQ→GTF epic (#43407): make async chart data opt-in per 
request.** After step 4 moved async execution onto the Global Task Framework, 
this makes async **opt-in per request** and adds the deployment/per-dashboard 
controls for it.
   
   **Backend**
   
   - **`async_mode` per-request flag on `/chart/data`.** Async runs only when 
the request sets `async_mode` (an absent flag is treated as synchronous), so 
programmatic API clients keep the synchronous HTTP 200 flow. Async still 
additionally requires `GLOBAL_ASYNC_QUERIES`, a full JSON result, and caching 
on. Documented on `ChartDataQueryContextSchema` (popped in `post_load` — it's a 
request flag, not part of the `QueryContext`). The decision is centralized in 
`ChartDataRestApi._should_run_async`.
   - **`GLOBAL_ASYNC_QUERIES` force-enables `GLOBAL_TASK_FRAMEWORK`** at 
startup (with a log line; a custom feature-flag func can still override), since 
async chart data runs on GTF.
   - **New config `GLOBAL_ASYNC_QUERIES_DEFAULT`** (default `True`) — a 
frontend-only policy input for the UI's default `async_mode`, exposed via 
bootstrap conf.
   
   **Frontend**
   
   - **`resolveAsyncMode()` policy chain** — `GLOBAL_ASYNC_QUERIES` 
feature-flag gate → per-dashboard override → `GLOBAL_ASYNC_QUERIES_DEFAULT`. 
Full-JSON chart-data renders inject `async_mode` accordingly (exports and 
non-full result types stay synchronous), so the UI stays async by default when 
the flag is on.
   - **Per-dashboard override** in the dashboard Properties modal — an 
"Asynchronous query execution" control (Deployment default / Force enabled / 
Force disabled), shown only when `GLOBAL_ASYNC_QUERIES` is enabled, persisted 
to `json_metadata.async_mode`, and threaded through `exploreJSON` so that 
dashboard's charts honor it. A value set directly in the Advanced JSON editor 
takes precedence (mirrors `refresh_frequency`).
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — no change to how charts render for end users. Adds an opt-in control 
in dashboard properties (visible only when `GLOBAL_ASYNC_QUERIES` is enabled).
   
   ### TESTING INSTRUCTIONS
   
   - With `GLOBAL_ASYNC_QUERIES` enabled, confirm `GLOBAL_TASK_FRAMEWORK` is 
enabled automatically (startup log line) and dashboards/explore load charts 
async by default.
   - Set `GLOBAL_ASYNC_QUERIES_DEFAULT = False`; confirm the UI loads 
synchronously by default, and a dashboard set to "Force enabled" loads its 
charts async.
   - POST `/api/v1/chart/data` without `async_mode` → HTTP 200 (synchronous); 
with `"async_mode": true` (flag on, full JSON, caching on) → HTTP 202 with 
`task_ids`.
   
   Automated: `pytest tests/unit_tests/charts/test_chart_data_api.py 
tests/unit_tests/feature_flag_test.py tests/unit_tests/initialization_test.py`; 
frontend `npm run test -- asyncMode chartActions PropertiesModal`.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [x] Required feature flags: `GLOBAL_ASYNC_QUERIES` (force-enables 
`GLOBAL_TASK_FRAMEWORK`)
   - [x] Changes UI (dashboard Properties: async-mode override)
   - [ ] Includes DB Migration
   - [x] Introduces new feature or API (`async_mode` request flag; 
`GLOBAL_ASYNC_QUERIES_DEFAULT` config)
   - [ ] Removes existing feature or API
   
   ---
   
   Targets the `gaq-to-gtf` feature branch (part of #43407), not `master`.
   


-- 
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