- Notifications
You must be signed in to change notification settings - Fork 401
feat: add enable_simple_view to PipelineJob.list() #1614
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits Select commit Hold shift + click to select a range
3fbdb35
feat: add enable_simple_view to PipelineJob.list()
sararob 31c92e8
updates to pipelinejob.list read_mask
sararob afd0327
run linter
sararob e91cfc2
Merge branch 'main' into pipeline-list-readmask
sararob b3c0210
update to read_mask
sararob bcdd068
add placeholder for read_mask to system tests
sararob d1de8b3
unit test fix
sararob 4772ab8
add system test for read_mask filter
sararob d5c3ffe
move read mask fields to constants file
sararob 6a868e4
add read_mask docstrings
sararob 53136d9
Merge branch 'main' into pipeline-list-readmask
sararob 1429ea2
remove class name check
sararob 1497a6b
Merge branch 'main' into pipeline-list-readmask
sararob 20a34b8
Merge branch 'main' into pipeline-list-readmask
sararob 4e43f72
Merge branch 'main' into pipeline-list-readmask
sasha-gitg afdf791
Merge branch 'main' into pipeline-list-readmask
sasha-gitg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
| @@ -38,6 +38,7 @@ | |
from google.cloud.aiplatform.utils import yaml_utils | ||
from google.cloud.aiplatform.utils import pipeline_utils | ||
from google.protobuf import json_format | ||
from google.protobuf import field_mask_pb2 as field_mask | ||
| ||
from google.cloud.aiplatform.compat.types import ( | ||
pipeline_job as gca_pipeline_job, | ||
| @@ -56,6 +57,8 @@ | |
# Pattern for an Artifact Registry URL. | ||
_VALID_AR_URL = pipeline_constants._VALID_AR_URL | ||
| ||
_READ_MASK_FIELDS = pipeline_constants._READ_MASK_FIELDS | ||
| ||
| ||
def _get_current_time() -> datetime.datetime: | ||
"""Gets the current timestamp.""" | ||
| @@ -509,6 +512,7 @@ def list( | |
cls, | ||
filter: Optional[str] = None, | ||
order_by: Optional[str] = None, | ||
enable_simple_view: Optional[bool] = False, | ||
project: Optional[str] = None, | ||
location: Optional[str] = None, | ||
credentials: Optional[auth_credentials.Credentials] = None, | ||
| @@ -530,6 +534,17 @@ def list( | |
Optional. A comma-separated list of fields to order by, sorted in | ||
ascending order. Use "desc" after a field name for descending. | ||
Supported fields: `display_name`, `create_time`, `update_time` | ||
enable_simple_view (bool): | ||
Optional. Whether to pass the `read_mask` parameter to the list call. | ||
This will improve the performance of calling list(). However, the | ||
returned PipelineJob list will not include all fields for each PipelineJob. | ||
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. I think here we can specify what fields are missing. | ||
Setting this to True will exclude the following fields in your response: | ||
`runtime_config`, `service_account`, `network`, and some subfields of | ||
`pipeline_spec` and `job_detail`. The following fields will be included in | ||
each PipelineJob resource in your response: `state`, `display_name`, | ||
`pipeline_spec.pipeline_info`, `create_time`, `start_time`, `end_time`, | ||
`update_time`, `labels`, `template_uri`, `template_metadata.version`, | ||
`job_detail.pipeline_run_context`, `job_detail.pipeline_context`. | ||
project (str): | ||
Optional. Project to retrieve list from. If not set, project | ||
set in aiplatform.init will be used. | ||
| @@ -544,9 +559,18 @@ def list( | |
List[PipelineJob] - A list of PipelineJob resource objects | ||
""" | ||
| ||
read_mask_fields = None | ||
| ||
if enable_simple_view: | ||
read_mask_fields = field_mask.FieldMask(paths=_READ_MASK_FIELDS) | ||
_LOGGER.warn( | ||
"By enabling simple view, the PipelineJob resources returned from this method will not contain all fields." | ||
) | ||
| ||
return cls._list_with_local_order( | ||
filter=filter, | ||
order_by=order_by, | ||
read_mask=read_mask_fields, | ||
project=project, | ||
location=location, | ||
credentials=credentials, | ||
|
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add doc string for this and the one in the next method?