-
Notifications
You must be signed in to change notification settings - Fork 15
feat: API pipeline run get has execution summary #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ycq/api_pipeline_run_list_has_ended
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -156,11 +156,21 @@ def create( | |
| session.refresh(pipeline_run) | ||
| return PipelineRunResponse.from_db(pipeline_run) | ||
|
|
||
| def get(self, session: orm.Session, id: bts.IdType) -> PipelineRunResponse: | ||
| def get( | ||
| self, | ||
| session: orm.Session, | ||
| id: bts.IdType, | ||
| include_execution_stats: bool = False, | ||
| ) -> PipelineRunResponse: | ||
| pipeline_run = session.get(bts.PipelineRun, id) | ||
| if not pipeline_run: | ||
| raise errors.ItemNotFoundError(f"Pipeline run {id} not found.") | ||
| return PipelineRunResponse.from_db(pipeline_run) | ||
| response = PipelineRunResponse.from_db(pipeline_run) | ||
| if include_execution_stats: | ||
morgan-wowk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| response = self._populate_execution_stats( | ||
| session=session, response=response | ||
| ) | ||
| return response | ||
|
|
||
| def terminate( | ||
| self, | ||
|
|
@@ -274,12 +284,22 @@ def _create_pipeline_run_response( | |
| ) | ||
| response.pipeline_name = pipeline_name | ||
| if include_execution_stats: | ||
| stats, summary = self._get_execution_stats_and_summary( | ||
| session=session, | ||
| root_execution_id=pipeline_run.root_execution_id, | ||
| response = self._populate_execution_stats( | ||
| session=session, response=response | ||
| ) | ||
| response.execution_status_stats = stats | ||
| response.execution_summary = summary | ||
| return response | ||
|
|
||
| def _populate_execution_stats( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general, I prefer functions that return value, rather than methods that modify things in-palce.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yuechao-qin Seems like this comment is not addressed
morgan-wowk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| self, | ||
| session: orm.Session, | ||
| response: PipelineRunResponse, | ||
| ) -> PipelineRunResponse: | ||
| stats, summary = self._get_execution_stats_and_summary( | ||
| session=session, | ||
| root_execution_id=response.root_execution_id, | ||
| ) | ||
| response.execution_status_stats = stats | ||
| response.execution_summary = summary | ||
| return response | ||
|
|
||
| def _get_execution_stats_and_summary( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.