Commit Graph

86 Commits

Author SHA1 Message Date
Connor McCarthy 13736b85b6
chore(sdk): clean up kfp code style (#8027)
* remove unused imports

* use google as isort profile

* sort imports

* format with yapf

* clean end of file new line, trailing whitespace, double quoted strings
2022-07-15 00:06:34 +00:00
Connor McCarthy 4621aec146
chore(sdk): apply yapf formatting (#7414) 2022-03-16 20:34:36 +00:00
Yaqi Ji 8bb0d0e025
feat(sdk)!: move v2 to main namespace (#7376)
* feat(sdk)!: move v2 to main namespace

* edit samples
2022-03-04 21:56:51 +00:00
Yaqi Ji b693909a08
feat(sdk)!: move v1 to deprecated folder (#7291)
* chore(sdk): move v1 to deprecated

* fix testsg

* fix testsg

* fix setup.py

* fix test

* s'

* fix tests

* fix test

* retore v2 test changes

* fix py3.6 test

* fix py3.6 test

* fix py3.6 import fallback error

* remove deprecated

* fix samples test

* sample test

* fix samples

* add readme

* restroe test

* python require

* remove path

* fix tests

* inteegration tests

* remove tfx tests for dependency with kfp v1

* fix e2e

* fix e2e

* fix integration tests

* fix sampe

* move client down

* change to kfp

* add import alias

* fix

* runid

* fix dsl

* only use kfp for function

* revert train_until_good

* tfx test

* kfp

* try import

* onprem
2022-03-04 00:52:59 +00: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
Chen Sun b200e1bc7d
fix(sdk): Fix URI placeholder in v2 compatible mode. (#6040)
* fix uri placeholder in v2 compatible mode

* fix tests

* fix path generation

* fix tests

* fix test

* cleanup

* clean up

* fix test

* fix test

* fix test
2021-07-21 08:32:50 -07:00
Chen Sun 58f74d3347
feat(sdk): special handling for type annotation using `typing.Optional` (#5716)
* handle type annotation with Optional

* remove typing._GenericAlias, which is available only after Py 3.7

* fix

* fix py3.6 test

* address review comments
2021-05-25 06:57:09 -07:00
Chen Sun b7084f2906
fix(sdk.v2): fix a small bug in `io_types.is_artifact_annotation()` (#5699)
* fix is_artifact_annotation

* move tests
2021-05-19 15:58:46 -07:00
Alexey Volkov cc83e1089b
Assigned copyright to the project authors (#5587) 2021-05-05 13:53:22 +08:00
Ajay Gopinathan b46f1b86f1
fix(sdk): Update syntax for lightweight components v2. (#5568)
* Update syntax for lightweight components v2.

Use Input[T] and Output[T] for representing input/output artifacts
of type T. This enables users to see these annotations as merely the
classes T, enabling autocompletion, reducing verbosity and simplifying
I/O types code. Users also no longer

Other changes include:
- no longer need to use .get() to obtain the artifact class
- no auto-creation of the `data` file for output artifacts. This enables
  artifacts to be either directories or files.

* fix for Py 3.6

* Remove stray file.

* Add error message if Input/Output are used with non Artifact types.

* Fix e2e test.
2021-04-29 19:27:30 -07:00
Ajay Gopinathan 55c14ccb2d
fix(sdk): Minor API fixes to Metrics classes. (#5494)
* Minor updates to Metrics classes.

* update goldens.

* fix tests.
2021-04-15 22:31:13 -07:00
Chen Sun 1a357a0ebe
chore(sdk.v2): Deprecate dsl.ontology_artifacts, and migrate to using dsl.io_types (#5472)
* merge ontology_artifacts to io_types

* remove tests importing ontology_artifacts

* fix tests
2021-04-15 21:38:13 -07:00
dushyanthsc 2c68229920
Fixes the Confusion Matrix storage format (#5463)
This change fixes the Confusion Matrix storage format to strictly adhere
with the schema type checking if supported.
2021-04-13 11:23:11 -07:00
Chen Sun a80421191d
feat(sdk.v2): surface metrics output artifacts to pipeline outputs (#5445)
* populates metrics outputs in root

* avoid kfp import in io_types.py

* populates outputs following the right path
2021-04-09 16:37:04 -07:00
Alexey Volkov ba3a92f6d0
chore(sdk): Refactored command-line resolving (#5379)
* SDK - Refactored command-line resolving

Moved the execution engine specific code to the component bridge.

* Added placeholder_resolver

This simplifies adding custom placeholder resolving logic.
2021-04-09 13:44:03 -07:00
dushyanthsc 0e7e543694
Adds classification metrics type to io_types (#5387)
Change to add support for Classification Metrics to io_types.

Also udpates IO types type_name from kfp. to system.
2021-03-30 20:46:18 -07:00
Asei Sugiyama d8028c5d9e
Fix(sdk): Enable FutureWarning with PipelineParam. Fix #5280 (#5299)
* init

* Update type annotation.

Arguments can be String, Integer, Float, Bool and PipelineParam passed from pipeline.

* Fix type annotation consistently.

* Add unit test.

* Fix unit test case.

* Fix after review, simplify by converting arguments and command to lists of str.
2021-03-30 02:56:17 -07:00
Chen Sun 0d2a341bad
chore(sdk): fix metrics schema title, and missing mapping (#5317)
* fix metrics schema title, and missing mapping

* fix tests

* fix tests
2021-03-18 12:19:16 -07:00
dushyanthsc 2323568267
feat(sdk): Adds Metrics & ClassificationMetrics ontology types (#5259)
Adds Metrics, ClassificationMetrics SlicedClassificationMetrics to ontology types.
Common methods used by helper metric classes and Artifact class are moved to
_artifact_utils.py
2021-03-12 03:19:24 -08: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
Jiaxiao Zheng ec7201db5a
feat(sdk.v2): Implement AI Platform (Unified) Custom job component in KFP v2 SDK (#5146)
* code skeleton

* wip

* add param scaffold

* add param scaffold

* wip: add new DSL class for AiPlatformCustomJob

* wip: play with container op i/o

* wip

* wip

* enhance get_parameter_type

* add tests

* add get_ir_type and tests

* add get_ir_type and tests

* wip: implementing get_custom_job, without IO

* add op IO

* clean up

* fix issues in aiplatform module

* cmd/arg resolution

* fix

* fix nonetyped cmds

* revert _structures

* revert component_tests

* revert component_bridge

* add basic tests

* add an e2e test

* fix tests

* resolve comments.

* fix test

* fix test
2021-02-24 17:18:15 -08:00
Jiaxiao Zheng a56efb2061
feat(sdk): Merge artifact ontology from v2 to the classic KFP. (#4963)
* move modules back to v1

* move and fix ontology tests
2021-01-07 23:00:53 -08:00
Ilias Katsakioris 8f70bf325e
fix(sdk): Do not wait for resource deletion (#4820)
When calling the delete() method of a ResourceOp we need to ensure we do
not wait for its deletion.

The reason for this is described in [1]: If a pipeline creates a
resource which is being consumed by its steps (e.g., a PVC), the step
deleting the resource will hang waiting for the Kubernetes resource
deletion which, in turn, is waiting for the other steps to get deleted.
As a result, the pipeline never finishes.

This commit allows specifying flags for the ResourceOp kubectl commands
and defaults to the '--wait=false' flag for the deletion.

Specifying flags for a ResourceTemplate is not supported in Argo v2.7
that we currently deploy. But they will be once we upgrade to v2.11+
[2]. This does not affect the delete() method because we don't rely on
Argo's ResourceTemplate for it.

[1] https://github.com/kubeflow/pipelines/issues/4506
[2] https://github.com/kubeflow/pipelines/issues/4553

Signed-off-by: Ilias Katsakioris <elikatsis@arrikto.com>
2020-12-17 16:54:24 -08:00
David Przybilla 5f992f5d06
fix(sdk): VolumeOp has apiVersion as parameter (#4694) 2020-11-21 03:05:33 -08:00
Abhishek Vilas Munagekar c52a81c1af
fix(sdk): fixes dsl.ContainerOp deprecation warning not shown (#4658)
* change dsl.ContainerOp warning to FutureWarning

* fix tests
2020-10-23 18:07:01 -07:00
Michalina Kotwica 0b3187966e
fix(sdk): Allow non-pythonic names for graph components' task's outputs. Fixes #4514. (#4515)
* add tests for pythonic and non-pythonic component outputs

* fix: graph for non-pythonic container output's names

Loading container component from component.yaml creates both
pythonic and original output names. Graph component iterated over
all outputs, using pythonic-to-output conversion on all. If some
of the names are not identical to their pythonic versions, they
rised KeyError on the lookup table.

This commit fixes this problem by using default value for the lookup.

* remove depythonification of outputs - not needed anymore
2020-09-28 20:53:25 -07:00
Alexey Volkov 03325848fc
feat(sdk): Components - Prevent passing unserializable objects to components. Fixes #4040 (#4496) 2020-09-16 02:23:22 -07:00
Alexey Volkov 7dc051b982
refactor(sdk): Refactored ResourceOp deletion (#3841) 2020-08-25 23:12:02 -07:00
Jiaxin Shan 390e80ed77
feat(sdk): add aws region field in use_aws_secret in kfp sdk (#4363) 2020-08-23 23:55:40 -07:00
Alexey Volkov 2f9482758b
feat(sdk): SDK - Deprecation warning when using ContainerOp (#4166)
* SDK - Added warning when not using components

We have long advised our users to create reusable components.
Creating reusable components is as easy as creating ContainerOp instances, but the components are shareable, portable and are easier to support going forward.

* Disable warning for TFX

* Fixed the warning disabling logic

* Added tests
2020-07-08 23:16:53 -07:00
Alexey Volkov d707b93fb4
feat(sdk): DSL - Added support for volatile components (#4104)
Volatile components do not reuse the cached results by default.
The pipeline authors can re-enable cache reuse if they want.
2020-07-06 18:09:57 -07:00
Thi Nguyen ec9445aa01
Allow PipelineParams in dict keys too. (#3565)
Co-authored-by: Thi Nguyen <duongnt@users.noreply.github.com>
2020-05-19 17:54:19 -07:00
Alexey Volkov 8ba366b03f
SDK - Made outputs with original names available in ContainerOp.outputs (#3734)
* SDK - Made outputs with original names available in ContainerOp.outputs

Previously, ContainerOp had strict requirements for the output names, so we had to convert all the names before passing them to the ContainerOp constructor. Outputs with non-pythonic names could not be accessed using their original names.
Now ContainerOp supports any output names, so we're now using the original output names.
However to support legacy pipelines, we're also adding output references with pythonic names.

* Fixed the compiler test data

* Fixed the duplicate parameter outputs in the compiled workflow

* Fixed long line

* Stabilized the output naming conflict resolution

* Fix case of missing special outputs
2020-05-12 19:08:26 -07: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
Alexey Volkov 7ee500f702
SDK - Tests - Improved tests for serializing lists containing objects (#3326)
Added test_fail_on_handling_list_arguments_containing_python_objects
Added test_handling_list_arguments_containing_serializable_python_objects
Moved test_handling_list_arguments_containing_pipelineparam to component_bridge_tests
2020-03-24 10:06:45 -07:00
Alexey Volkov be12ccf2a1
SDK - Moved the @python_component decorator test to dsl tests (#3324)
* SDK - Moved the @python_component decorator test to dsl tests

* Deprecate @python_component
2020-03-21 08:14:43 -07:00
Alexey Volkov 194278337b
SDK - Moved python op pipeline compilation test to bridge tests (#3323) 2020-03-21 00:18:44 -07:00
Alexey Volkov 264ff37c1e
SDK - Moved _dsl_bridge to dsl (#3267)
This is a pure refactoring change.
The components library should not have any dependencies on the DSL library.
2020-03-14 00:12:34 -07:00
Alexey Volkov 8ca603d679
SDK - Tests - Testing command-line resolving explicitly (#3257)
* SDK - Tests - Testing command-line resolving explicitly

After the recent small refactoring of the task resolving flow in the component library, some tests we left unupdated with compatibility shims added to make the tests pass.
This PR updates the remaining tests and removes the shims.
This mostly involves using explicitly using `_resolve_command_line_and_paths`.

Some tests that validate the behavior of the dsl bridge were moved to `component_bridge_tests.py`

* Indented the component texts
2020-03-11 19:38:38 -07:00
Ilias Katsakioris c220059c8d
SDK/DSL: Enable the deletion of a resource via ResourceOp method (#3213)
* SDK/DSL: Enable the deletion of a resource via ResourceOp method

* Add the method delete() to ResourceOps
* Extend ResourceOp & VolumeOp tests

Signed-off-by: Ilias Katsakioris <elikatsis@arrikto.com>

* Fix ValueError not being raised
2020-03-10 16:07:36 -07:00
xiaohanhuang e704067d15
add an optional name for dsl.Condition (kubeflow#3210) (#3212)
* add an optional name for dsl.Condition (kubeflow#3210)

* add unit test
2020-03-05 21:45:22 -08:00
Alexey Volkov c83aff2738
SDK - Components - Made it easier to access component spec classes (#2860)
* SDK - Components - Made it easier to access component spec classes

* Updated the imports
2020-01-31 11:41:21 -08:00
Alexey Volkov f39cbdca70 SDL - DSL - Stabilized the PipelineVolume names (#2794)
The name no longer depends on unset parameters or the version of the Kubernetes package.
Needed for https://github.com/kubeflow/pipelines/pull/2780
Fixes  https://travis-ci.com/kubeflow/pipelines/jobs/270786161
2020-01-03 18:07:40 -08:00
Alexey Volkov 27f7e77356 SDK - Unified the function signature parsing implementations (#2689)
* Replaced `_instance_to_dict(obj)` with `obj.to_dict()`

* Fixed the capitalization in _python_function_name_to_component_name
It now only changes the case of the first letter.

* Replaced the _extract_component_metadata function with _extract_component_interface

* Stopped adding newline to the component description.

* Handling None inputs and outputs

* Not including emply inputs and outputs in component spec

* Renamed the private attributes that the @pipeline decorator sets

* Changged _extract_pipeline_metadata to use _extract_component_interface

* Fixed issues based on feedback
2019-12-27 10:05:40 -08:00
Ilias Katsakioris 4624ac817d SDK/DSL: Fix PipelineVolume name length (#2739)
* SDK/DSL: Fix PipelineVolume name length

Volume name must be no more than 63 characters

Signed-off-by: Ilias Katsakioris <elikatsis@arrikto.com>

* Change which part of the hash value we make use of

Signed-off-by: Ilias Katsakioris <elikatsis@arrikto.com>
2019-12-18 12:52:04 -08: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
Alexey Volkov 4c24650e5f SDK - Tests - Fixed most of the test warnings (#2336) 2019-10-22 18:06:13 -07:00
Alexey Volkov 735e627a03 SDK - Refactoring - Split the K8sHelper class (#2333)
* SDK - Refactoring - Split the K8sHelper class

One part was only used by container builder and provided higher-level API over K8s Client.
Another was used by the compiler and did not use the kubernetes library.

* Updated the license year.
2019-10-21 14:57:22 -07:00
Ilias Katsakioris a77d8e9d03 SDK/DSL: ContainerOp.add_pvolume - Fix volume passed in add_volume (#2306)
Signed-off-by: Ilias Katsakioris <elikatsis@arrikto.com>
2019-10-04 19:59:12 -07:00
Alexey Volkov 6afb91b902
SDK - Fix pipeline metadata serialization (#2137)
Two PRs have been merged that turned out to be slightly incompatible. This PR fixes the failing tests.
Root causes:
* The pipeline parameter default values were not properly serialized when constructing the metadata object.
* The `ParameterMeta` class did not validate the default value type, so the lack of serialization has not been caught. The `ParameterMeta` was replaced by `InputSpec` which has strict type validation.
* Previously we did not have samples with complex pipeline parameter default values (e.g. lists) that could trigger the failures. Then two samples were added that had complex default values.
* Travis does not re-run tests before merging
* Prow does not re-run Travis tests before merging
2019-09-17 13:07:34 -07:00