Skip to content

fix(sdk): Add in filter to list_pipeline_versions SDK method #7223

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 2 commits into from
Feb 4, 2022

Conversation

alexlatchford
Copy link
Contributor

@alexlatchford alexlatchford commented Jan 26, 2022

Description of your changes:

Currently when using kfp pipeline list-versions --filter "..." $pipeline_id it breaks with:

list_pipeline_versions() got an unexpected keyword argument 'filter'

Looks like adding the filter was just missed when it was added into the SDK :)

Copy link
Member

@chensun chensun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @alexlatchford for the fix!
Other than the nitpicks I left in comments, can you please add a release note for this PR?

@@ -1401,7 +1401,8 @@ def list_pipeline_versions(
pipeline_id: str,
page_token: str = '',
page_size: int = 10,
sort_by: str = ''
sort_by: str = '',
filter: str = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if the default value is None, then it should be :Optional[str] = None

BTW, were you able to test this with both default None and a real value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I'm just copying the pattern established in this earlier PR that introduced the filter argument 😅 I can certainly confirm it works with the filter set as we're running this within the Zillow-specific fork of the kfp-sdk we maintain 😄

I've fixed this type hint (and updated the type hints for all the list_* client method arguments too), I'm happy to test out with no filter if needs be. Let me know if you want me to try it out or if you're happy without :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is more of a style thing, it doesn't affect runtime behavior. Our code may have many other styling issues, and we want to be more compliance to the style for newly added code at least.
https://google.github.io/styleguide/pyguide.html#3195-nonetype

@@ -1410,6 +1411,8 @@ def list_pipeline_versions(
page_token: Token for starting of the page.
page_size: Size of the page.
sort_by: One of 'field_name', 'field_name desc'. For example, 'name desc'.
filter: A url-encoded, JSON-serialized Filter protocol buffer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to give an example of what a filter value could be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added an example to all the affected areas. Looks like the URL encoding actually happens under the hood as a part of the REST client in kfp-server-api so technically you don't need to provide a URL encoded filter, I can update the docstring if that works?

Also in the comment I'm referring to a private dictionary interface which holds the mapping between op name and index, not ideal but happy to make that interface public if you want? We could expose it via from kfp import FILTER_OPERATIONS or something like that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's good enough for now. Thanks!

Copy link
Contributor Author

@alexlatchford alexlatchford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @chensun I think I've addressed all your points!

@@ -1401,7 +1401,8 @@ def list_pipeline_versions(
pipeline_id: str,
page_token: str = '',
page_size: int = 10,
sort_by: str = ''
sort_by: str = '',
filter: str = None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I'm just copying the pattern established in this earlier PR that introduced the filter argument 😅 I can certainly confirm it works with the filter set as we're running this within the Zillow-specific fork of the kfp-sdk we maintain 😄

I've fixed this type hint (and updated the type hints for all the list_* client method arguments too), I'm happy to test out with no filter if needs be. Let me know if you want me to try it out or if you're happy without :)

@@ -1410,6 +1411,8 @@ def list_pipeline_versions(
page_token: Token for starting of the page.
page_size: Size of the page.
sort_by: One of 'field_name', 'field_name desc'. For example, 'name desc'.
filter: A url-encoded, JSON-serialized Filter protocol buffer
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added an example to all the affected areas. Looks like the URL encoding actually happens under the hood as a part of the REST client in kfp-server-api so technically you don't need to provide a URL encoded filter, I can update the docstring if that works?

Also in the comment I'm referring to a private dictionary interface which holds the mapping between op name and index, not ideal but happy to make that interface public if you want? We could expose it via from kfp import FILTER_OPERATIONS or something like that?

@alexlatchford alexlatchford requested a review from chensun February 2, 2022 19:45
@google-oss-prow
Copy link

@alexlatchford: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
kubeflow-pipelines-samples-v2 e6aaffe link true /test kubeflow-pipelines-samples-v2

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@chensun
Copy link
Member

chensun commented Feb 4, 2022

/lgtm
/approve

Thanks!

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chensun

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@chensun
Copy link
Member

chensun commented Feb 4, 2022

@alexlatchford: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
kubeflow-pipelines-samples-v2 e6aaffe link true /test kubeflow-pipelines-samples-v2

The test failure is not related to this change. I'll ignore it and force merge the change.

@chensun chensun merged commit 808ff5d into kubeflow:master Feb 4, 2022
abaland pushed a commit to abaland/pipelines that referenced this pull request May 29, 2022
…w#7223)

* AIP-5661: Add in filter to list_pipeline_versions SDK method

* AIP-5661: Update type hints + docstrings to conform to standard. Include message in release notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants