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)!: SDK client v2beta1 API integration. Fixes #8706 #9112

Merged
merged 7 commits into from
Apr 12, 2023

Conversation

chensun
Copy link
Member

@chensun chensun commented Apr 6, 2023

Description of your changes:
Migrate SDK client to use v2beta1 API.

Manually tested all public method with most commonly used arguments.

Checklist:

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from chensun. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@google-oss-prow google-oss-prow bot requested a review from zijianjoy April 6, 2023 17:19
@chensun
Copy link
Member Author

chensun commented Apr 6, 2023

Fixes #8706.

Test failures are expected because we haven't released kfp-server-api==2.0.0b1 yet, which we plan to do in the next couple of days.

@chensun chensun changed the title feat(SDK): SDK client v2beta1 API integration. feat(SDK): SDK client v2beta1 API integration. Fixes #8706 Apr 6, 2023
Copy link
Member

@connor-mccarthy connor-mccarthy left a comment

Choose a reason for hiding this comment

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

/lgtm

sdk/python/kfp/client/client.py Show resolved Hide resolved
sdk/python/kfp/client/client.py Show resolved Hide resolved
sdk/python/kfp/client/client.py Show resolved Hide resolved
@@ -495,16 +491,16 @@ def get_pipeline_id(self, name: str) -> Optional[str]:
"""
pipeline_filter = json.dumps({
'predicates': [{
'op': _FILTER_OPERATIONS['EQUALS'],
'key': 'name',
'operation': _FILTER_OPERATIONS['EQUALS'],
Copy link
Member

Choose a reason for hiding this comment

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

Would the key change from 'op' to 'operation' be a breaking change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately yes, this is a breaking change. I guess when we made the API changes, we missed that SDK users could pass in this as a string.
Technically we could avoid breaking SDK users by loading the JSON back to a dict and do a string replacement on behalf of the user, but I feel a bit hesitate to introduce such a hack that alters user provided value. Hopefully this breakage would be easy to discover and easy to fix. WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

Agreed that this is a very minor breaking change. I'm okay with not fixing. It will be easy to add that hack if it turns out to be a pain point for users. Plus, we don't promise backward compatibility from the main namespace to KFP SDK v2 anyway and the client is associate most with the main namespace in KFP v1.


::

json.dumps({
"predicates": [{
"op": _FILTER_OPERATIONS["EQUALS"],
"key": "name",
"operation": "EQUALS",
Copy link
Member

Choose a reason for hiding this comment

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

Curious: why remove _FILTER_OPERATIONS here?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is in the docstring part, and _FILTER_OPERATIONS isn't exposed, the example is not really runnable--it needs to be at least kfp.client._FILTER_PERATIONS[...] to be runnable.
Also the API works with either the enum name or the enum value, if users has to know the key EQUALS, there's really no point for them to convert the key to its enum value here.

@google-oss-prow google-oss-prow bot added the lgtm label Apr 6, 2023
@chensun
Copy link
Member Author

chensun commented Apr 11, 2023

/retest

@chensun
Copy link
Member Author

chensun commented Apr 12, 2023

@chensun: 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-sdk-execution-tests 7f32ec2 link true /test kubeflow-pipelines-sdk-execution-tests

The test was expected to pass with the latest backend release, but somehow the test cluster was not updated following kubeflow/testing#1026
Will investigate the infra issue separately, and continue ignoring the test failure for now.
/cc @Linchin @connor-mccarthy

output_format,
)


@recurring_run.command()
@click.argument('job-id')
@click.argument('recurring-run-id')
Copy link
Member Author

Choose a reason for hiding this comment

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

Chose to break the CLI interface because it's painful to support both old and new parameters in the code path, and I expect CLI users usually use it in a more interactive way, the cli helper makes it easier to discover the parameter changes. Thoughts? @connor-mccarthy

Copy link
Member

@connor-mccarthy connor-mccarthy Apr 12, 2023

Choose a reason for hiding this comment

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

SGTM. What do you think about adding a section to the website docs beneath this one? https://github.com/kubeflow/website/blob/2ca1e2cf634cdd5311f68d06d25674aaf084a87b/content/en/docs/components/pipelines/v2/migration.md#cli-output-change

Probably would only need a sentence or two and I don't think we need to enumerate every break.

Could also be good to mention the new canonical name "recurring run".

Copy link
Member Author

Choose a reason for hiding this comment

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

SG. Will follow up on the documentation changes.

Copy link
Member

@connor-mccarthy connor-mccarthy left a comment

Choose a reason for hiding this comment

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

/lgtm

@google-oss-prow google-oss-prow bot added lgtm and removed lgtm labels Apr 12, 2023
@chensun chensun changed the title feat(SDK): SDK client v2beta1 API integration. Fixes #8706 feat!(SDK): SDK client v2beta1 API integration. Fixes #8706 Apr 12, 2023
@chensun chensun changed the title feat!(SDK): SDK client v2beta1 API integration. Fixes #8706 feat(SDK)!: SDK client v2beta1 API integration. Fixes #8706 Apr 12, 2023
@google-oss-prow
Copy link

@chensun: 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-sdk-execution-tests 26fee2d link true /test kubeflow-pipelines-sdk-execution-tests

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.

Copy link
Member

@connor-mccarthy connor-mccarthy 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 for this big update and the associated testing!

@google-oss-prow google-oss-prow bot added the lgtm label Apr 12, 2023
@chensun chensun merged commit 07d6c18 into kubeflow:master Apr 12, 2023
@chensun chensun mentioned this pull request Apr 12, 2023
1 task
rd-pong pushed a commit to rd-pong/pipelines that referenced this pull request Apr 26, 2023
…ubeflow#9112)

* SDK client v2beta1 API integration.

* fix unit tests

* create alias for use of methods and fields referencing `job`.`

* fix cli

* fix pipeline list-versions

* more cli fixes

* client fix
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