Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cloud_pipelines_backend/api_server_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,8 @@ def get(self, session: orm.Session, id: bts.IdType) -> GetExecutionInfoResponse:
def get_graph_execution_state(
self, session: orm.Session, id: bts.IdType
) -> GetGraphExecutionStateResponse:
if not session.get(bts.ExecutionNode, id):
raise errors.ItemNotFoundError(f"Execution with {id=} does not exist.")
ExecutionNode_Child = orm.aliased(
bts.ExecutionNode, name="child_execution_node"
)
Expand Down
7 changes: 7 additions & 0 deletions tests/test_execution_nodes_api_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ def test_no_children_returns_empty_stats(self):
assert result.child_execution_status_summary.ended_executions == 0
assert result.child_execution_status_summary.has_ended is True

def test_missing_execution_raises_not_found(self):
"""An absent execution raises ItemNotFoundError (404) instead of
returning empty stats that look like a finished graph."""
with self.session_factory() as session:
with pytest.raises(errors.ItemNotFoundError):
self.service.get_graph_execution_state(session, "does-not-exist")

def test_children_with_no_status_are_excluded(self):
"""Children whose container_execution_status is None are not counted."""
with self.session_factory() as session:
Expand Down