PG1204 opened a new issue, #5775:
URL: https://github.com/apache/texera/issues/5775

   ### Task Summary
   
   Make the performance heat-map survive a page refresh: remember the overlay 
toggle and selected view, and restore the last execution's per-operator 
statistics on load so the heat-map renders without re-running the workflow.
   
   ### Context
   
   After the overlay lands (#5774), it is session-only. Reloading the workspace 
loses both the layer state and the statistics:
   - The Layers toggles (Grid / Regions / Workers, and the new Performance 
layer)  do not persist; they reset to off on refresh.
   - `WorkspaceComponent` clears live websocket-derived state on entry via 
`resetWorkflowSessionState()`, so a finished run's per-operator statistics are 
gone after reload and the heat-map has nothing to color.
   
   The data needed to restore a finished run already exists server-side. The 
backend persists runtime statistics per execution, and 
`WorkflowExecutionsService.retrieveWorkflowRuntimeStatistics(wid, eId, cuid)` 
already returns them (with the full timing fields) from 
`/executions/{wid}/stats/{eId}`. No backend change is required as this sub-task 
composes existing client APIs and feeds the result back through 
`WorkflowStatusService` (using the `setExternalStatus` ingestion point added in 
#5773).
   
   Before:  refresh -> session state cleared -> heat-map empty until re-run
   After:   refresh -> toggle/view restored -> last run's stats re-fetched -> 
fed into WorkflowStatusService -> heat-map renders
   
   ## Proposed Change
   
   In `frontend/src/app/workspace/component/menu/menu.component.ts`:
   - Persist the overlay state (`{ view: HeatmapView | null }`) to localStorage 
via the existing `localSetObject` / `localGetObject` helpers in 
`frontend/src/app/common/util/storage.ts`, under a single key.
   - On init, read it back, set the selector, and push the view into the 
`JointGraphWrapper` stream. Scope persistence to the Performance layer only; 
Grid / Regions / Workers stay non-persistent as today.
   
   New 
`frontend/src/app/workspace/service/heatmap/heatmap-stats-restore.service.ts`:
   - Resolve the workflow id, fetch executions, pick the latest (prefer the 
most recent completed run), capture its `eId` and `cuId`, fetch its runtime 
statistics, reduce to the latest snapshot per operator, map 
`WorkflowRuntimeStatistics` -> `OperatorStatistics`, and feed it into 
`WorkflowStatusService.setExternalStatus(...)`.
   
   In `frontend/src/app/workspace/component/workspace.component.ts`:
   - After the workflow loads and session state is reset, invoke the restore 
service, gated on the overlay being persisted-on so non-users incur no extra 
fetch. Skip if a live execution is already in progress, so the live stream wins.
   
   ### Required Test
   
   - Mapper spec: full-row mapping, status code -> `OperatorState`, 
latest-per-operator reduction, unicode operator id, and empty input → empty 
result.
   - `heatmap-stats-restore.service` spec (mocked `WorkflowExecutionsService`): 
no executions -> no ingestion and no throw, multiple executions -> latest 
picked, in-progress-only run still loads, and an HTTP error is swallowed.
   - Menu spec: a persisted view restores the overlay on init; an absent or 
null state leaves the overlay off and triggers no restore fetch.
   
   ### Related
   
   - Umbrella issue #5772 
   - Depends on #5773, #5774 
   - RFC discussion #5216
   
   ### Task Type
   
   - [ ] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [ ] Testing / QA
   - [ ] Documentation
   - [x] Performance
   - [x] Other


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

Reply via email to