Skip to content
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

feat(sdk): Add filters to python client. #6748

Merged
merged 3 commits into from
Oct 28, 2021

Conversation

jmcarp
Copy link
Contributor

@jmcarp jmcarp commented Oct 15, 2021

Description of your changes:

The backend and generated python code accept filters for resource list requests, but we don't expose those in the client. This patch exposes filters as appropriate as json-encoded strings. Note: we might want to accept filters as lists of dicts, or we could generate python classes from filters.proto and pass in Filter objects instead. Any preference on this?

Checklist:

@google-oss-robot
Copy link

Hi @jmcarp. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

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.

The backend and generated python code accept filters for resource list requests, but we don't expose those in the client.

Just curious, when was the filter option added? Is there a minimum version of backend/API that we need to be aware of for this change?

@@ -506,7 +506,8 @@ def list_experiments(self,
page_token='',
page_size=10,
sort_by='',
namespace=None):
namespace=None,
filter=None):
Copy link
Member

Choose a reason for hiding this comment

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

Can you please document this argument below in the function docstring?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Choose a reason for hiding this comment

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

@@ -1061,7 +1066,8 @@ def list_runs(self,
page_size=10,
sort_by='',
experiment_id=None,
namespace=None):
namespace=None,
filter=None):
Copy link
Member

Choose a reason for hiding this comment

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

ditto: docstring

return response

def list_recurring_runs(self,
page_token='',
page_size=10,
sort_by='',
experiment_id=None):
experiment_id=None,
filter=None):
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@chensun
Copy link
Member

chensun commented Oct 19, 2021

The backend and generated python code accept filters for resource list requests, but we don't expose those in the client.

Just curious, when was the filter option added? Is there a minimum version of backend/API that we need to be aware of for this change?

I took a look, seems to be there for a long time, no need to worry about the minimum version.

Can you please add an entry in the release note under "Current version" ?

https://github.com/kubeflow/pipelines/blob/master/sdk/RELEASE.md

@jmcarp
Copy link
Contributor Author

jmcarp commented Oct 26, 2021

Updated @chensun.

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.

/lgtm

Thanks!

sdk/RELEASE.md Outdated
@@ -17,6 +17,7 @@

* Fix placeholder mapping error in v2. [\#6794](https://github.com/kubeflow/pipelines/pull/6794)
* Depends on `kfp-pipeline-spec>=0.1.13,<0.2.0` [\#6803](https://github.com/kubeflow/pipelines/pull/6803)
* Add optional `filter` argument to list methods of KFP client.
Copy link
Member

Choose a reason for hiding this comment

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

nit: Add the PR link at the end just like the rest? See if you want to edit this yourself, or I can help as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@chensun
Copy link
Member

chensun commented Oct 28, 2021

/lgtm
/approve

Thanks!

@google-oss-robot
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 Oct 28, 2021

/lgtm

@google-oss-robot
Copy link

@jmcarp: 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 76fcebf 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 Oct 28, 2021

Adding another data point to #6815

https://4e18c21c9d33d20f-dot-datalab-vm-staging.googleusercontent.com/#/runs/details/d1bb5bb3-f157-469b-9058-93d234e4d30f

One of the print_op in a loop failed with error:

failed to try resolving symlinks in path "/var/log/pods/kubeflow_my-pipeline-bgdnw-2290115955_fb33b214-5e9c-4287-83d9-019e0e140801/main/0.log": lstat /var/log/pods/kubeflow_my-pipeline-bgdnw-2290115955_fb33b214-5e9c-4287-83d9-019e0e140801/main/0.log: no such file or directory

All the rest print_ops succeeded.

Going to ignore the test failure and merge as-is.

@JakeSummers
Copy link

This feature would be much easier to use if there were Python types available for the filter. See #8778

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.

None yet

4 participants