feat(sdk): add kubeflow_client PipelinesClient (phase 1). Fixes #13380#13405
feat(sdk): add kubeflow_client PipelinesClient (phase 1). Fixes #13380#13405MStokluska wants to merge 3 commits into
Conversation
Signed-off-by: MStokluska <mstoklus@redhat.com>
Signed-off-by: MStokluska <mstoklus@redhat.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @MStokluska. 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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
| def list_runs( | ||
| self, | ||
| *, | ||
| pipeline: str | None = None, |
There was a problem hiding this comment.
Regarding the pipeline filter in list_runs:
The pipeline parameter is included because KEP-125 specifies it as part of the Phase 1 API surface. However, it's worth noting that this filter is applied client-side - the KFP v2beta1 ListRuns API does not currently support server-side filtering by pipeline ID.
Why it's client-side: The backend stores PipelineId as a column in the run_details table (via the embedded PipelineSpec struct in backend/src/apiserver/model/pipeline_spec.go), but this field is not exposed in the runAPIToModelFieldMap (backend/src/apiserver/model/run.go), which defines the set of valid filter keys accepted by the filter query parameter.
Caveats of the current approach:
The returned page may contain fewer items than page_size (including zero items with a non-empty next_page_token) because filtering happens after the server returns a page.
Callers must continue paginating until next_page_token is empty to get complete results which IMO isn't great UX.
How this can be fixed upstream: enable server-side filtering via the existing filter protocol buffer mechanism, eliminating the pagination inconsistency. Once that backend change lands, this client method can switch to server-side filtering transparently (no public API change needed).
There was a problem hiding this comment.
Pull request overview
Implements Phase 1 of a new kfp.kubeflow_client.PipelinesClient: a simplified, name-first Python client built directly on kfp_server_api, including pipeline CRUD, run submission (by name, callable, YAML, or model objects), experiment management, run waiting, host auto-discovery, and token-based auth (with refresh support).
Changes:
- Added
PipelinesClient+PipelinesBackendConfigwith endpoint/namespace discovery and bearer-token authentication support. - Implemented pipeline upload/versioning, run creation/listing, experiment CRUD, and a flexible
wait_for_run_status()helper. - Added
kfp.kubeflow_clientpackage exports, type aliases, run-state constants, and a substantial unit test suite.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/python/kfp/kubeflow_client/pipelines_client.py | New PipelinesClient implementation (pipelines/runs/experiments, host discovery, auth refresh, helpers). |
| sdk/python/kfp/kubeflow_client/pipelines_client_test.py | Unit tests for the new client and key helpers. |
| sdk/python/kfp/kubeflow_client/types.py | Type aliases over kfp_server_api model classes for cleaner public API. |
| sdk/python/kfp/kubeflow_client/constants.py | Lowercased run state constants + terminal-state set used by wait/filter logic. |
| sdk/python/kfp/kubeflow_client/init.py | Package-level re-exports for the new client, types, and constants. |
|
Thanks for this work @MStokluska! Will check this out soon /assign @andreyvelich |
Signed-off-by: MStokluska <mstoklus@redhat.com>
Description of your changes:
Summary
Implements Phase 1 of the
PipelinesClient(KEP-125) — a simplified, name-first Python client for Kubeflow Pipelines built directly onkfp_server_api.PipelinesClientclass withPipelinesBackendConfigdataclass for connection configurationupload_pipeline,get_pipeline,get_pipeline_version,list_pipelines,list_pipeline_versions,delete_pipelinerun(callable, YAML path, name, Pipeline/PipelineVersion objects),get_run,list_runs,wait_for_run_status(flexible target states, callbacks, token refresh)create_experiment(idempotent),get_experiment,list_experiments,delete_experimentkfp.Clientviakfp_clientpropertyTest plan
pytest -v sdk/python/kfp/kubeflow_client/pipelines_client_test.pyIssue: #13380
Checklist: