Commit Graph

84 Commits

Author SHA1 Message Date
Judah Rand c605c51b85
chore(sdk.v2): use `Annotated` rather than `Union` hack (#6573)
* Use `Annotated` rather than `Union` hack

* Add dependency to `setup.py`

* Add release note

Co-authored-by: Chen Sun <chensun@users.noreply.github.com>
2021-09-16 10:54:55 -07:00
Alex Latchford b613ca847b
fix(sdk): Update upper bound on kubernetes constraint in Python SDK (#6532) 2021-09-08 18:46:00 -07:00
Chen Sun 29226e9178
feat(sdk.v2): Support container environment variable in v2. (#6515)
* Support `set_env_variable` in v2.

* update release note
2021-09-07 13:30:07 -07:00
Joshua Carp f43ecc223d
chore(sdk): Import mock from stdlib and drop dependency. (#6456)
* Import mock from stdlib and drop dependency.

* Drop mock from requirements.

h/t @chensun
2021-08-31 16:38:44 -07:00
Yaqi Ji 65174cdd93
feat(sdk): Add BaseModel to component_spec data classes (#6372)
* pydantic setup

* switch to union types

* Fix base_component tests

* switch to pydantic for python3.6 compat and fix tests

* Fix tests

* use str for type

* fix tests

* Consistent quote sign

* Address comments

* Update type
2021-08-25 14:00:02 -07:00
Yaqi Ji 937cacd4ce
feat(sdk): add default schema_version to pipeline (#6366)
* feat(sdk): add default schema_version to pipeline

* sync api for go

* Fix tests and address comments

* Bump pipeline_spec version

* Fix v1 tests

* rebase to master

* sync api for go

* Fix tests and address comments

* Bump pipeline_spec version

* Fix v1 tests
2021-08-24 01:04:39 -07:00
Ajay Gopinathan f3f383c2ff
chore(sdk): Refactor and move all v2 related code to under the v2 namespace. (#6358)
* Refactor and move all v2 related code to under the v2 namespace.

Most of the changes are around imports and restructuring of the
codebase. While it looks like a lot of code was added, most of the code
already existed and was simply moved or copied over to v2. The only
exceptions are:
- under kfp/v2/components/component_factory.py: some helper functions
  were copied with simplification from _python_op.py
- we no longer strip the `_path` suffix in v2 components.

Note: there is still some duplication of code (particularly between
component_factory.py and _python_op.py), but it's ok for now since we
intend to replace some of this with v2 ComponentSpec + BaseComponent.

* Update setup.py.

* update tests.

* revert accidental change of gcpc

* Fix component entrypoint.

* Update goldens.

* fix tests.

* fix merge conflict.

* revert gcpc change.

* fix tests.

* fix tests.

* Add type aliases for moved files.

* merge and update goldens.
2021-08-17 19:25:37 -07:00
Chen Sun 903b98654e
feat(sdk.v2): Define BaseComponent, ComponentSpec, and PipelineTask. (#6210)
* Define BaseComponent, ComponentSpec, and PipelineTask.

* fix dep

* disable positional arguments

* address feedback

* address feedback
2021-08-06 08:54:43 -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
john li 5dcbd35b71
chore: add link and Python 3.8/3.9 classifiers to setup.py (#5715)
* Add link and Python 3.8/3.9 classifiers to setup.py

The link should appear on PyPI: https://pypi.org/project/kfp/#description

* use "The Kubeflow Authors" in setup.py

* Include more links in Python package description
2021-06-04 12:47:48 -07:00
Chen Sun 6b87155a33
feat(sdk.v2): Support Exit handler in v2 compiler. (#5784) 2021-06-03 12:58:36 -07:00
Alexey Volkov 4e5d724fef
feat(sdk): Dropped support for Python 3.5. Fixes #4584 (#4611)
Fixes https://github.com/kubeflow/pipelines/issues/4584
2021-05-28 17:20:00 -07:00
Chen Sun bf8681b7e3
feat(sdk.v2): Add Google AIPlatformClient (#5677)
* ai platform client

* fix test

* update URL
2021-05-18 13:33:34 -07:00
Chen Sun f20d20c41d
feat(sdk.v2): Experimental custom job support. (#5604)
* custom job

* simple vs. advanced setting (user specified raw workerpoolspecs)

* fix typo
2021-05-11 18:33:25 -07:00
Alexey Volkov cc83e1089b
Assigned copyright to the project authors (#5587) 2021-05-05 13:53:22 +08:00
Chen Sun 85cb99173d
feat(sdk.v2): fix loop implementation and add subvar support (#5461)
* fix loop dag and add subvar support

* Bump kfp-pipeline-spec min version to 0.1.7
2021-04-12 16:59:03 -07:00
Chen Sun 6603e8ba1f
feat(sdk): relax kubernetes upper constraint from <12 to <13 (#5349) 2021-03-22 18:41:50 -07:00
Chen Sun 6502a8a49a
chore(sdk): enforce lower and upper bounds on all dependencies. (#5258)
* Update setup.py

* Update requirements.in
2021-03-14 17:57:47 -07:00
dushyanthsc 3e55bd3637
Artifact class update to support protobuf Struct (#5197)
Change updates dsl Artifact class to support protobuff based metadata
removing existing implementation that uses properties/custom_properties
to handle metadata.

This change modifies the ontology artifacts with enhanced schemas for
model and datasets.
2021-03-03 16:14:48 -08:00
Yuan (Bob) Gong 6e96fb4523
chore(sdk): update requirements.in to be in sync with setup.py (#5187)
* Update requirements.in

* Update requirements.in

* chore(sdk): keep requirements.in and setup.py in-sync
2021-02-25 00:52:15 -08:00
Chen Sun a2e2e6ca6f
feat(sdk.v2): support dsl.Condition in v2. (#5127)
* support condition in sdk.v2

* address review comments
2021-02-12 15:05:57 -08:00
Chen Sun 16a4fe26ea
fix(sdk): Add back 'kfp.v2.components' as a package in setup.py (#5099) 2021-02-04 03:07:37 -08:00
Chen Sun cbb255396d
chore(sdk): add `absl-py` in kfp install_requires (#5097)
* Update setup.py

* Update setup.py
2021-02-04 01:03:36 -08:00
Chen Sun 91c5a93c8e
chore(sdk.v2): Migrate to the new IR with subdag support (#4981)
* migrate to new ir

* address review comments

* fix bugs

* fix pipeline parameters and tests

* fix components import

* fix typo
2021-02-03 04:11:37 -08:00
Chen Sun 2e7eb9d356
fix(SDK): require PyYAML>=5.3 (#5063) 2021-01-30 23:36:02 -08:00
Chen Sun ecb14f40bb
chore(sdk): Remove v2 components fork, use v1 instead. (#5042)
* Remove v2.components fork

* fix setup.py
2021-01-28 18:20:07 -08:00
Jiaxiao Zheng 279694ec6d
feat(sdk): Container entrypoint used for new styled KFP component authoring (#4978)
* skeleton

* add entrypoint utils to parse param

* wip: artifact parsing

* add input param artifacts passing and clean unused code

* wip

* add output artifact inspection

* add parameter output

* finish entrypoint implementation

* add entrypoint_utils_test.py

* add entrypoint test

* add entrypoint test

* get rid of tf

* fix test

* fix file location

* fix tests

* fix tests

* resolving comments

* Partially rollback

* resolve comments in entrypoint.py

* resolve comments
2021-01-14 16:01:21 -08:00
Yuan (Bob) Gong 7fca374e94
chore(sdk): bump kfp-server-api dependency to >= 1.1.2 (#4909) 2020-12-17 13:10:25 -08:00
Yuan (Bob) Gong cc47ad9dfc
chore(sdk): bump sdk's dependency on kfp-server-api (#4855)
* chore(sdk): bump sdk's dependency on kfp-server-api

* Update setup.py

* Update setup.py

* Update setup.py
2020-12-04 01:55:26 -08:00
Chen Sun 148dd8dcdb
chore(sdk): pin kfp-pipeline-spec version (#4748)
* pin kfp-pipeline-spec version

* kfp 1.1.1
2020-11-11 16:32:28 -08:00
Chen Sun 7cf620323f
chore(sdk): Use pipeline_spec proto from kfp-pipeline-spec package (#4745)
* Use pipeline_spec proto from kfp-pipeline-spec package

* update imports

* use pre-released kfp-pipeline-spec (temporarily)

* Revert "use pre-released kfp-pipeline-spec (temporarily)"

This reverts commit 77f2e9a39c.

* test_requires

* version

* make kfp a namespace package

* move to the top

* version rc0
2020-11-10 16:14:41 -08:00
Chen Sun a51380b065
chore(sdk): Add InputUri and, OutputUris placeholders in v2 (#4728)
* Fix bug where we missed injecting importer node

* moved files

* address review comments

* Add InputUriPlaceholder and OutputUriPlaceholder

* support uri placholder in v2

* lint

* test

* Preserve a test case with inputPath and outputPath usage.

* fix ut

* fix import and setup

* address comments
2020-11-09 11:37:58 -08:00
Chen Sun 5020fd1079
compiler for IR (#4529)
* Compile IR proto in setup.py

* compile to IR

* Fix importer node logic and lint

* cleanup and lint

* merge, undo setup.py change

* cleanup and lint

* remove currently unused code

* format _component_bridge.py

* cleanup and format

* cleanup

* upgrade protobuf in test

* restructure and test

* address review comments

* fix bug

* avoid f-strings formatting

* address review comments

* address review comments

* limit the primitive types to only int, double, and string.

* Fix test for python3.5

* use instance_schema instead of schema_title

* add v2 to setup.py

* address review comments

* move the tests closer to the code

* add more tests

* cleanup and linting

* add more tests

* fix bug on input paramter connection

* linting

* restructure tests

* fix python3.5 test failure

* support outputs.parameters placeholder

* remove pipeline decorator from v2.dsl
2020-10-13 17:13:54 -07:00
Abhishek Vilas Munagekar 5613db02bc
feat(sdk): Python components - Parse component input/output descriptions from the function docstring (#4512)
* cleanup imports

* add description to inputs and outputs

* update requirements

* add test

* improve component description

* update tests

* review changes: fix lint and requirements

* upgrade docstring-parser
2020-09-19 23:22:29 -07:00
Alexey Volkov 39975e3cde
SDK - Components - Temporary removed Kubernetes options from ComponentSpec (#4230)
* SDK - Components - Replaced Kubernetes options with generic launcher options

This reduces the schema size and makes the task launcher options more flexible.

* Removed the launcherOptions for now
2020-07-16 19:59:00 -07:00
Alexey Volkov f74fde251e
test(sdk): SDK - Added the mock package to the test requirements (#4132) 2020-07-02 01:24:46 -07:00
Yuan (Bob) Gong b12023ef3b
[Release] Various fixes to release script (#3918)
* Update kustomize/base/params.env

* fix

* kfp sdk requirement updated to kfp_api_server<2.0.0

* Fix major minor parsing

* Also fix cloudbuild.yaml
2020-06-05 13:32:21 +08:00
Alexey Volkov b63ad7e614
SDK - Removed the ArtifactLocation feature (#3517)
* SDK - Removed the ArtifactLocation feature

The feature was deprecated in v0.1.34 https://github.com/kubeflow/pipelines/pull/2326

* Removed the artifact_location sample
2020-04-23 00:49:44 -07:00
hongye-sun 3dbbb16903
update version to 0.5.0 (#3566) 2020-04-22 14:00:50 -07:00
Alexey Volkov b6bc24a014
SDK - Added pinned dependency snapshot (#3303)
* SDK - Added pinned dependency snapshot

* Downgraded zipp

The zipp package has dropped support for python3.5. https://zipp.readthedocs.io/en/latest/history.html#v2-0-0
https://github.com/jaraco/zipp/issues/28

* Fixing sample building in the backend Dockerfile

Installing SDK using pip.
Using SDK's requirements.txt.

* Enabled kubernetes v11

* Reverted the backend/Dockerfile for now

* Fixed the version of kfp-server-api
2020-03-30 00:53:53 -07:00
Ajay Gopinathan d6abac5e8d
Bump version to 0.3.0 (#3329)
* Bump version to 0.3.0

* Fix formatting

* More formatting fixes

* More formatting fixes

* update requirements.txt

* update version
2020-03-22 19:44:45 -07:00
Alexey Volkov 95aec25db4
SDK - Support kubernetes client v11 (#3319)
Fixes https://github.com/kubeflow/pipelines/issues/3275
2020-03-22 02:54:44 -07:00
Yuan (Bob) Gong f8a4521876
[SDK] Use new released kfp-server-api package (#3224)
* [SDK] Use new released kfp-server-api package

/assign @numerology

* Update setup.py

* Update setup.py

* Fix requirements.txt
2020-03-11 01:45:36 -07:00
Alexey Volkov 578d8de91d
SDK - Reduce python component limitations - no import errors for cust… (#3106)
* SDK - Reduce python component limitations - no import errors for custom type annotations

By default, create_component_from_func copies the source code of the function and creates a component using that source code. No global imports are captured. This is problematic for the function definition, since any annotation, that uses a type that needs to be imported, will cause error. There were some special provisions for
NamedTuple,  InputPath and OutputPath, but even they were brittle (for example, "typing.NamedTuple" or "components.InputPath" annotations still caused failures at runtime).

This commit fixes the issue by stripping the type annotations from function declarations.

Fixes cases that were failing before:

```python
import typing
import collections

MyFuncOutputs = typing.NamedTuple('Outputs', [('sum', int), ('product', int)])

@create_component_from_func
def my_func(
    param1: CustomType,  # This caused failure previously
    param2: collections.OrderedDict,  # This caused failure previously
) -> MyFuncOutputs: # This caused failure previously
    pass
```

* Fixed the compiler tests

* Fixed crashes on print function

Code `print(line, end="")` was causing error: "lib2to3.pgen2.parse.ParseError: bad input: type=22, value='=', context=('', (2, 15))"

* Using the strip_hints library to strip the annotations

* Updating test workflow yamls

* Workaround for bug in untokenize

* Switched to the new strip_string_to_string method

* Fixed typo.

Co-Authored-By: Jiaxiao Zheng <jxzheng@google.com>

Co-authored-by: Jiaxiao Zheng <jxzheng@google.com>
2020-02-24 20:50:48 -08:00
Renmin 10a4f55e3a Release bae654dc5c v0.1.40 (#2818)
* Updated component images to version bae654dc5c

* Updated components to version ff116b6f1a

* 0.1.40

* append old items

* fix line

Co-authored-by: renmingu <40223865+renmingu@users.noreply.github.com>
2020-01-09 01:33:46 -08:00
Alexey Volkov bae654dc5c SDK - Bumping the upper version of Kubernetes package (#2780) 2020-01-08 19:01:40 -08:00
hongye-sun 1b04983d96
update server and sdk version to 0.1.37 (#2701)
* update server and sdk version to 0.1.37

* update api package version to latest

* fix test error
2019-12-05 17:05:07 -05:00
Niklas Hansson 88b4757d5b SDK - Python support for arbitrary secret, similar to ".use_gcp_secret('user-gcp-sa')" (#2639)
* added new secret support

* updated the documentation and env settings

* updated after feedback

* added tests

* nameing issue fixed

* renamed test to follow unittest standard

* updated after feedback

* the new test after renaming

* added the test to main

* updates after feedback

* added licensce agreement

* removed space

* updated the volume named to be generated

* secret_name as volume name and updated test

* updated the file structure

* fixed build
2019-12-03 12:00:59 -08:00
Stephen Henderson c66120bda7 Adding missing kfp.cli.diagnose_me package to setup.py (#2610)
The kfp.cli.diagnose_me package was missing from the setup.py packages list and so wasn't included in the latest release pushed to pypi.org.
2019-11-15 00:59:42 -08:00
Alexey Volkov 5043ec78af SDK - Setup - Added cloudpickle to requirements (#2437)
* SDK - Setup - Added cloudpickle to requirements

* Specifying the exact cloudpickle version
2019-10-21 15:45:23 -07:00