feat: Executions - API - Expose container status history on the details endpoint#288
Open
morgan-wowk wants to merge 1 commit into
Open
feat: Executions - API - Expose container status history on the details endpoint#288morgan-wowk wants to merge 1 commit into
morgan-wowk wants to merge 1 commit into
Conversation
…ls endpoint
Surface ExecutionNode.extra_data status-change history (recorded by the
status-transition instrumentation) as a new status_history field on
GetExecutionInfoResponse (GET /api/executions/{id}/details).
Each entry is {status, first_observed_at}; the list is ordered and the last
entry corresponds to the node's current status, so its first_observed_at is
when the node entered that status. This lets clients compute true
time-in-status (e.g. how long a task has been PENDING/QUEUED) instead of
relying on a browser-session heuristic. Malformed/partial entries are skipped;
absence yields null rather than an empty list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
status_historyfield toGetExecutionInfoResponse(served by GET/api/executions/{id}/details).The status-transition instrumentation in
orchestrator_sql.pyalready records, on every container-execution status change (deduped on consecutive identical statuses), an entry{status, first_observed_at}intoExecutionNode.extra_data["container_execution_status_history"]. That data was DB-only — no endpoint exposed it. This surfaces it on the details endpoint (which is keyed on theExecutionNode, the same entity that ownsextra_data, and is available regardless of container launch).Why
Clients can now compute true time-in-status for a task. The list is ordered and its last entry is the node's current status, so
status_history[-1].first_observed_atis exactly when the node entered that status — including pre-launch states likeQUEUED/PENDINGthat have noContainerExecutionrow (so/container_statecan't help).Details
StatusHistoryEntrydataclass:{status: str, first_observed_at: datetime}.first_observed_atis parsed from the stored ISO-8601 string to adatetime.nullrather than[].kw_onlydataclass with a default).Tests
tests/test_execution_nodes_api_service.py— newTestGetExecutionInfo:datetimeNonewhen no history presentpytest tests/test_execution_nodes_api_service.py→ 7 passed.blackclean.