Commit Graph

117 Commits

Author SHA1 Message Date
Alex Latchford 808ff5d8ed
fix(sdk): Add in filter to list_pipeline_versions SDK method (#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
2022-02-03 16:52:45 -08:00
Gerard Casas Saez fc2d05f90d
fix(sdk): Respect namespace if set on client (#7056)
* respect namespace if set on client

* make sure is_multi_user

* overwrite directly context_setting

* revert non-related changes

* revert overwrite_namespace

* expand text

* add release notes

* add PR link
2022-01-11 06:04:42 +00:00
Yuan (Bob) Gong ca6e05591d
test: update README of v2 sample test (#7121)
* test: update README of v2 sample test

* address review comments by @zijianjoy

* use absolute paths, suggested by @zijianjoy

* Update README.md
2021-12-30 16:22:54 +08:00
Alex Latchford ddbfcde16f
feat(sdk): Improve CLI experience for archiving experiments, managing recurring runs and listing resources (#6934) 2021-12-01 18:07:13 +00:00
hieuhc 6d55e262b4
fix(sdk): refresh access token only when it expires. Fixes #6883 (#6941)
* refresh access token whenerver it expires

* tight the condition when refreshing the access token
2021-11-23 19:35:07 +00:00
Joshua Carp 37d3234ce5
feat(sdk): Add filters to python client. (#6748)
* Add filters to python client.

* Add filter docstrings.

h/t @chensun

Co-authored-by: Chen Sun <chensun@users.noreply.github.com>
2021-10-28 01:15:50 -07:00
Gerard Casas Saez 5dfae1d8cc
feat(sdk): Add version description optionally to Py SDK. Part of #6256 (#6472)
* add description optionally

* add release notes

* add new line

* capture if description is not accepted by server

* add todo comment

* add better description api missing exception
2021-10-24 21:24:07 -07:00
johnmacnamararseg ba0bb60de9
feat(sdk): Extend SDK client with disable/delete run methods (#6754)
* add disbale/delete run (job) functions to sdk client

* change run to job to accuratly reflect api

* add release note for change

* align docstrings with style guide requirements

* formatting

Co-authored-by: Chen Sun <chensun@users.noreply.github.com>
2021-10-19 11:40:39 -07:00
Nabil Abdellaoui 95162e2372
chore(sdk): Remove stack trace so it doesn't look like an error (#6590)
* Stack trace makes it look like an error

* Update RELEASE.md
2021-09-24 10:20:37 -07:00
Kausthub Krishnamurthy 8b55b1632e
fix(sdk): removed duplicate function. Fixes #6586 (#6594)
* fix(sdk): removed duplicate list_pipeline_versions function [ fixes #6586 ]

* sdk RELEASE.md: update SDK RELEASE note bugfix log
2021-09-22 01:26:44 -07:00
Joshua Carp 139acc88a6
feat(sdk): Configure pipeline run service account. Fixes #6424 (#6455) 2021-09-03 18:08:10 -07:00
Chen Sun 2f19a26ffd
chore(sdk): Format all Python files under SDK folder. (#6501)
* Reformat sdk only using the new yapf config.

* Reformat docstrings using docformatter.

* update golden files to resolve diff caused by whitespaces

* fix some tests

* format .py files under sdk/python/tests using yapf

* additional docformatter

* fix some tests
2021-09-03 11:25:11 -07:00
Yuan (Bob) Gong 9afe125a75
revert: "feat(sdk): Add description to upload_pipeline_version in kfp. Part of #6256" (#6468)
This reverts commit 8b51cc4f22.
2021-08-30 00:42:24 -07:00
Gerard Casas Saez 8b51cc4f22
feat(sdk): Add description to upload_pipeline_version in kfp. Part of #6256 (#6395) 2021-08-21 23:45:56 -07:00
Gerard Casas Saez 3ec8b82fa4
feat(sdk): Allow parametrization of ui_host in kfp.Client (#6124)
* Update _client.py

* add docs
2021-08-02 14:02:10 -07:00
Chen Sun 24c551d3fc
feat(sdk.v2): enable_caching in v2 client defaults to compile time settings. (#6052) 2021-07-15 14:58:37 -07:00
Chen Sun 158d15f92b
feat(sdk): Add submission time caching option override for v2 compatible mode. (#6032)
* Add submission time caching option override for v2 compatible mode.

* fix tests

* casting

* disable cache for sample test

* cleanup

Co-authored-by: capri-xiyue <52932582+capri-xiyue@users.noreply.github.com>
2021-07-14 22:05:50 -07:00
Ilias Katsakioris 52b0792e9f
feat(sdk): Add credentials to authenticate with ServiceAccountTokens. Part of #5138 (#5676)
* Introduce ServiceAccountTokenVolumeCredentials

Part of kubeflow/pipelines#5138

This is a subclass of TokenCredentials and implements the logic of
retrieving a service account token provided via a ProjectedVolume.

The 'get_token()' method reads and doesn't store the token as the
kubelet is refreshing it quite often.

Relevant docs:
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#service-account-token-volume-projection

* Attemp to use credentials when in-cluster

If the KFP client detects it's running inside a pod and the user hasn't
provided any credentials, it now attempts to set up credentials based on
a projected service account token.

* Move credentials to kfp.auth module

Also change some names and values to avoid "ml-pipeline" references.

* Import kfp.auth lazily during the Client init

* Have credentials handle errors internally

* Let ServiceAccountTokenVolumeCredentials handle OSErrors internally
* Have the default-creds-setter only check if credentials provide a
  valid value
* Use Configuration's 'refresh_api_key_hook' instead of having duplicate
  code

* Remove dead code

* Add kfp.auth in the setup.py

* Move abstraction to the 'refresh_api_key_hook' method
2021-07-08 16:48:22 -07:00
Elias Nehme cbb83a5628
feat(sdk): json serialization of dict/list items in run args, fixes #5896 (#5927) 2021-07-01 03:23:23 -07:00
Graham Brereton 8b9756247c
fix(sdk): Update documentation for cron_expression parameter to kfp.Client().create_recurring_run (#5642)
- Correct the number of cron fields required
- Add a link to the documentation for the cron expression format
2021-05-18 18:49:42 -07:00
Ilias Katsakioris 89364315e9
feat(sdk): Introduce the token credentials interface. Part of #4683 (#5287)
* Introduce TokenCredentials abstract class

As presented in kubeflow/pipelines#4683, in this commit we introduce a
TokenCredentials abstract class which encapsulates the retrieval and
refresh of token credentials.

The reason we are using a class for the credentials is the fact that
usually tokens are short-lived and the client needs to refresh them.

All subclasses should define a 'get_token()' method responsible for
fetching and refreshing (if needed) a token for authentication.

* Configure credentials when initializing KFP client
2021-05-18 01:10:41 -07:00
Chen Sun f09131f1f7
feat(sdk.v1): Add pipeline_root as an argument to client's public run methods. (#5632) 2021-05-11 19:21:25 -07:00
Alexey Volkov cc83e1089b
Assigned copyright to the project authors (#5587) 2021-05-05 13:53:22 +08:00
Civitaspo 075b83af9c
feat(sdk): Introduce new environment variables for kfp oauth2 clients (#5043) 2021-04-18 21:31:15 -07:00
Niklas Hansson 43486e772b
fix(sdk): faster get experiment by name respects casing. Fixes #5172 (#5370)
* use lowercase for comparison

* updated to use filters properly

* fix error

* update the name

* clean up and fix after feedback
2021-03-28 04:14:48 -07:00
Ajay Gopinathan a1d453af21
chore(sdk): Allow the launcher image to be configurable. (#5360)
* Allow the launcher image to be configurable. This is especially useful
for tests.

* Address PR comments.
2021-03-23 08:27:44 -07:00
Chen Sun a1aea7be4d
feat(sdk): Uses 'https' as the default host protocol if users didn't specify any. (#5298) 2021-03-16 12:49:15 -07:00
Minhwan Kim 7c1793c70b
feat(sdk): Make cli.experiment use kfp.Client methods instead of using kfp_server_api directly (#5267)
* Make cli.experiment.list_experiments use kfp.Client.list_experiments for multi-user environment

* Add delete_experiment method to kfp.Client and make cli.experiment.delete use this method
2021-03-15 12:43:14 -07:00
Ajay Gopinathan 83eded130c
feat(sdk): Introduce experimental v2-compatibility in KFP SDK (#5218)
* WIP: Enable v2 compatibility in KFP SDK compiler.

* First pass clean up

* Clean up and introduce enum instead of boolean for execution mode.

* More cleanup

* Clean up and add comments.

* Undo formatting changes.

* Undo formatting changes.

* Add method to unconditionally add kfp pod env.

* minor formatting change.

* Update docstrings.

* Undo formatting changes.

* fix imports.

* fix pod_env tests

* rebased.

* undo format changes.

* Undo compiler changes.:

* format _default_transformers.py for consistency

* Fix various rebasing issues.

* fix bug referring to pipeline_name/pipeline_root in v1 pipelines.

* revert output dir name.

* allow both types of attributes for pipeline root.

* fix pod env yaml golden.

* fix for input/output uri tests.

* Add v2 compatible compiler test.

* Use ordereddict to fix flaky golden file tests.

* Address PR comments.

* Address PR comments.

* Address PR comments.
2021-03-08 15:40:23 -08:00
Jiyong Jung e07ba451af
fix(sdk): fixes typo of 'desc'. (#4938) 2020-12-24 00:38:26 -08:00
Yuan (Bob) Gong 44fcda7dca
fix(sdk): make healthz exception visible in logs by default (#4904)
* fix(sdk): make healthz exception visible in logs by default

* only catch exceptions, but not keyboard interrupt

* address comments
2020-12-16 20:29:08 -08:00
capri-xiyue 2b718f1bbd
docs(sdk): update comments of _create_job_config (#4899)
* update comments of _create_job_config

* cleand up comments

* fixed comments
2020-12-16 06:16:22 -08:00
DavidSpek 0df9473bba
feat: Set current namespace for in-cluster SDK in multi-user mode and add healthz endpoint to API backends (#4638)
* Set current namespace in local KFP context if running from notebook

* Create "~/.config/kfp/" instead of ".config/kfp/"

At first it was assumed the `get_user_namespace` command would be executed from the home directory.

* Create local context file if it doesn't exist during set_user_namespace

* Grab path from LOCAL_KFP_CONTEXT when creating folder

Instead of harcoding the os.mkdirs path to `~/.config/kfp` it now grabs it from the LOCAL_KFP_CONTEXT. Also, removed path creation in `get_user_namespace` as that is now handled in `set_user_namespace`. Also, it now checks if the path exists rather than the local_context_file to remove the situation where it tries to create ~/.config/kfp/ because the context.json doesn't exist when the path does.

* add multi-user setting to healthz api

* Add http prefix to health api url

* move healtz api call to own function and fix multi_user boolean

* Fix HEALTH_PATH declaration

* Move check to Client __init__ and change get_kfp_healthz to avoid breaking in case of old apiserver image

* Add multi_user to frontend healthz

* Expose multi_user in frontend and add integration test

* Fix integration test

* Fix host hardcoding and error handling

* Handle empty API response, check if API up to date

* Fix response return

* remove API check due to empty response

* retry API call if first response empty

* retry getting healthz api if no response

* change health_api to https

The healthz_api has been returning empty responses which might be caused by sending an http request to an https endpoint. Although requests handles redirects, this commit is to test if this solves the issue.

* Add some debug info to healthz exception

* add url to debug and lower retries to 1

* Use api_client to get healthz data

* Debug info for API response

* Follow API redirect history

* Fix indentation

* Add healthz proto

* Try getting healthz api with new python backend

* Add installation of kfp_server_api in tests

* Fix incorrect setup location

* Replace old .get with new http backend .multi_user

* Code clean up

* Small fixes and TimeOutError for retries healthz api

* Remove changes to go dependencies

* Send empty proto request and fix exception client

* Remove unused commit_sha and tag_name
2020-11-24 15:36:39 -08:00
Alexey Volkov 5c1b919793
fix(sdk): Client - Fixed wait_for_run_completion (#4808)
The default timeout value is of type timedelta which cannot be compared with a plain number later in the code.
Also replaced time_delta.seconds with time_delta.total_seconds() which gives out correct value.
2020-11-22 15:19:34 -08:00
Tanguy Compagnon 950fae4921
fix(sdk): fixes too broad except when retrieving experiments. (#4765) 2020-11-12 15:08:25 -08:00
Marcin Owsiany a840ce75e3
fix(sdk): use a meaningful link text in ipython (#4570) 2020-10-07 04:30:42 -07:00
Padarn Wilson aed37c7792
feat(sdk): optional context in kubenetes client (#4401)
* adding optional context to client

* update naming of context -> kube_context
2020-09-29 14:33:24 -07:00
Yihong Wang c8b4599622
feat(sdk/cli): add extra header for cli (#4400)
In some cases, it may need extra header to handle the API calls.
Directly add `header_name` and `header_value` props in
`.config/kfp/context.json` and pass the name/value pair
to APIClient.

Here is one of the use cases:
if the service is protected by istio RBAC and need JWT header
for authentication, you can specify the JWT id-token in
the .config/kfp/context.json with these two new props.
The id-token would be carried in the specified header name.
Then the API call can be properly authentiecated and checked
if the user has the permission to access the service.
2020-09-22 11:06:42 -07:00
Jiaxiao Zheng f98252f3d7
chore: Corrects doc string of two client methods. (#4442)
* clean up doc string for two methods

* add missing arg doc

* add missing type hints.
2020-09-08 13:57:52 -07:00
Lars Schöning d7e5894912
fix(sdk): TypeError in Client.get_pipeline_id() when pipeline does not exist (#4319) 2020-08-05 07:40:28 -07:00
Alex Latchford 704c8c7660
chore: Clean up KFP SDK docstrings, make formatting a little more consistent (#4218)
* Prepare SDK docs environment so its easier to understand how to build the docs locally so theyre consistent with ReadTheDocs.

* Clean up docstrings for kfp.Client

* Add in updates to the docs for compiler and components

* Update components area to add in code references and make formatting a little more consistent.

* Clean up containers, add in custom CSS to ensure we do not overflow on inline code blocks

* Clean up containers, add in custom CSS to ensure we do not overflow on inline code blocks

* Remove unused kfp.notebook package links

* Clean up a few more errant references

* Clean up the DSL docs some more

* Update SDK docs for KFP extensions to follow Sphinx guidelines

* Clean up formatting of docstrings after Ark-Kuns comments
2020-08-04 00:33:47 +08:00
Renmin cc78bd1a4f
fix(sdk/client): reserve the host protocal (http or https) so that http host can work. Fixes #4277 (#4285) 2020-07-29 20:38:30 -07:00
Renmin ac66626a2c
feat(sdk): support HTTP/S PROXY for SDK client (#4215)
* done

* done

* reserve https

* done
2020-07-22 01:42:05 -07:00
Tom Hastjarjanto 45c796e112
feat(sdk): Expose upload pipeline version (#4146)
* feat(SDK): Expose upload pipeline version

* feat(sdk): Improve parameter name

* feat: Add option to specify either pipeline_id or pipeline_name

* Update sdk/python/kfp/_client.py

fix: Missing import

Co-authored-by: Niklas Hansson <niklas.sven.hansson@gmail.com>

* Fix: Optionals, incorrect var reference

* Fix: import orders

* chore: PR feedback

Co-authored-by: Niklas Hansson <niklas.sven.hansson@gmail.com>
2020-07-17 09:43:01 -07:00
Paulo Roberto de Oliveira Castro d91ac0f217
feat(sdk/client): add cookie configuration to kfp client (#2679)
* Add cookie configuration to kfp client

* Change cookie->cookies and add docs
2020-07-14 23:08:37 -07:00
Jiaxiao Zheng d3ef0dcbd0
fix(sdk): fixes the default value for _is_refresh_token. Fixes #4189 (#4195) 2020-07-09 16:56:34 -07:00
Ilias Katsakioris 749538d031
fix(sdk): Fix get_experiment when there are no experiments. Fixes #4176 (#4177)
Signed-off-by: Ilias Katsakioris <elikatsis@arrikto.com>
2020-07-08 13:25:21 -07:00
Niklas Hansson aae1eba096
feat(sdk): CLI - Allow upload_version by the pipeline's name. Fixes #3901 (#4087)
* Update _client.py

* Allow for passing name instead of only pipeline_id

* fixed old rebase issue

* protobuf fix

* raise error and remove f-string

* moved file

* updated python proto packages versions

* Update sdk/python/kfp/_client.py

* restructured and added to build

* changes structure of import

* Updated the files

* further updates of client and filter.proto

* alternative

* clean up

* clean up

* remove helperfiles

* futher clean up

* clean up or eaither name or id

* update doc strings

* remove page_size

* Update sdk/python/kfp/_client.py

Co-authored-by: Jiaxiao Zheng <jxzheng@google.com>

* Update sdk/python/kfp/cli/pipeline.py

Co-authored-by: Jiaxiao Zheng <jxzheng@google.com>

* updated to classical string formattin

Co-authored-by: Jiaxiao Zheng <jxzheng@google.com>
2020-07-08 03:37:10 -07:00
Pierre Tholoniat 50fd45fed9
Fix typo in error message (#3369)
"The package_file '+ package_file + ' should ends with..." replaced by "The package_file '+ package_file + ' should end with..."
2020-06-29 20:49:58 -07:00
Paul Selden a802dbbed0
[SDK] Add list_pipeline_versions to kfp.Client (#3340)
Allows the user to list available pipeline versions for a given pipeline id.
2020-06-19 01:43:58 -07:00