Commit Graph

101 Commits

Author SHA1 Message Date
Seb 577902ca46
fix(sdk): Support per workflow TTL (ttl_seconds_after_finished) with new format of Argo workflow manifest (#7141)
* Support per workflow TTL (ttl_seconds_after_finished) with new format of Argo workflow manifest

* Update test for TTL

* Declare fix in release note of SDK

* update syntaxe

* Update RELEASE.md

Add Braking change due to incompatibility with  KFP pre 1.7 due to Argo 2.X
2022-01-20 00:43:52 +00:00
Chen Sun 8aee62142a
feat(sdk)!: Deprecate V2 compatible mode in v1 compiler (#6958)
* Deprecate V2 compatible mode in v1 compiler

* release note

* fix tests
2021-11-24 22:11:34 +00:00
Yaqi Ji c4d8dfd8c6
feat(sdk): ImporterSpec v2 (#6917)
* importer

* compiler

* check diff

* fix format

* remove v1 node test

* remove importer v2 compat test

* release note

* address comments
2021-11-18 23:11:32 +00:00
Niklas Hansson 343350a5f3
fix(sdk): podSpecPatch bug. Fixes 6512 (#6514)
* Fix podSpecPatch bug

* wrong structure for nodeselector and bring back integreation test

* updated python compiler test

* updated to use the correct GPU type

* missed to commit the updated test config

* Updated release notes

* remove test to see if it solved the issue
2021-09-09 15:26:51 -07:00
Chen Sun 439d8c87c1
chore(sdk): remove dead code on importer check in v1. (#6508)
* remove dead code

* Update RELEASE.md

* Update compiler.py

* Update v2_compatible_compiler_test.py

* Update compiler_tests.py

* Update RELEASE.md
2021-09-07 15:01:06 -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
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 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 434e5c3489
fix(sdk): block dsl.importer usage in KFP OSS. Fixes: #6323 (#6330)
* block dsl.importer in KFP OSS

* address cr comments
2021-08-16 01:02:06 -07:00
Chen Sun d48792c373
test(sdk): restore a v2-compatible unit test (#6263) 2021-08-09 11:18:23 -07:00
Niklas Hansson e6becd71ff
feat(sdk): add GPU runtime resource request and fix spelling in runtime_resouce_request. Fixes #4877. Fixes #1252 (#5972)
* Add runtime resource request for GPUs

* clean up

* Updated docks and add check

* updated with test

* remove from branch

* run tests

* fix gpu vendor format

* Update after feedback

* add unit tet

* remove integration test

* clean up

* Clean up

* Updated to resource_constraints instead of resource
2021-08-01 22:52:38 -07:00
Chen Sun f4c6631e51
chore: release KFP SDK and v2 launcher 1.6.6 (#6125)
* release 1.6.6

* skip failing UT
2021-07-23 14:49:39 -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
Yaqi Ji c6cb8acf7a
feat(sdk): Add interface for enable_caching at task level. (#6007)
* feat(sdk): Add pipeline level caching options

* Update golden

* fixing caching options

* fix tests

* add a caching disabled case

Co-authored-by: Chen Sun <chensun@users.noreply.github.com>
2021-07-13 17:33:58 -07:00
Joe Liedtke ade34542e0
chore: Updates argoproj/argo URLs to argoproj/argo-workflows (#5969)
* Updt argoproj/argo URLs to argoproj/argo-workflows

* Update link to workflows.ts

* Update license.txt to reduce # of changed lines

* Revert changes to backend Dockerfile & license.txt

* Update license.txt, keep line endings
2021-07-06 21:52:20 -07:00
Yuan (Bob) Gong 8a256db1bf
feat(sdk/dsl/compiler): dsl-compile --mode flag to turn on V2_COMPATIBLE, defaults to KF_PIPELINES_COMPILER_MODE env var. Fixes #5840 (#5952)
* feat(sdk/dsl/compiler): support --mode flag which can turn on v2 compatible mode

* override compiler default mode using KF_PIPELINES_COMPILER_MODE env var

* update V1_LEGACY to V1

* add unit tests

* address feedback

* clean up

* cleanup again

* use absl.testing.parameterized for table driven tests

* update
2021-07-03 02:22:49 -07:00
Niklas Hansson 5db843102a
feat(sdk): add runtime resource requests. Fixes #1956 (#5447)
* added resource request at runtime

* fixed things

* Update to use read only parameter insteadt

* added test case and better example

* Updated again

* add the validation

* add to the test suit

* work in progress

* update after feedback

* fix the test

* clean up

* clean up

* fix the path

* add the test again

* clean up

* fix tests

* feedback fix

* comment out and clean up
2021-06-10 16:27:59 -07:00
capri-xiyue 6717434978
[SDK] Add pod labels for telemetry purpose (#5582)
* Add pod labels for telemetry purpose

* fixed test

* added sdk label in pods

* added sdk type label

* fixed test

* added UT back

* updated UT
2021-05-05 10:43:27 -07:00
Alexey Volkov cc83e1089b
Assigned copyright to the project authors (#5587) 2021-05-05 13:53:22 +08:00
Ilias Katsakioris a12e88d1da
feat(sdk): Enable setting OwnerReference on ResourceOps. Fixes #1779 (#4831)
Argo supports a field in the ResourceTemplate that makes the controller
add an owner reference of the workflow to the created resource since
v2.4.0 [1].
With the upgrade of Argo client [2] and deployment [3] we are now able
to exploit it.

We set it to 'false' by default on all ResourceOps (actually, leave it
empty).

Setting the field to 'true' for VolumeOps allows the garbage collection
of PVCs upon workflow cleanup [4].

[1] https://github.com/argoproj/argo/blob/v2.4.0/pkg/apis/workflow/v1alpha1/workflow_types.go#L1044-L1045
[2] https://github.com/kubeflow/pipelines/pull/4498
[3] https://github.com/kubeflow/pipelines/pull/3537
[4] https://github.com/kubeflow/pipelines/issues/1779

Signed-off-by: Ilias Katsakioris <elikatsis@arrikto.com>
2021-03-12 06:45:24 -08:00
StefanoFioravanzo fa135fc0bc
feat(sdk): Support backoffs in retry strategy (#5060)
* feat(sdk): Support backoffs in retry strategy

Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>

* Add Optional type hint

Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
2021-03-03 03:59:48 -08:00
Michalina Kotwica ce985bc287
fix(sdk): Allow keyword-only arguments in pipeline function signature (#4544)
* add test for keyword-only arguments in pipeline func

* fix: kwargs-only argument for pipeline func

* test: kwargs generate same yaml as args

* remove whole metadata

* assert -> self.assertEqual

* programmatic example --> fixed example

* same name for both

Co-authored-by: Alexey Volkov <alexey.volkov@ark-kun.com>
2021-01-29 18:31:02 -08:00
radcheb 5633b9abda
fix(sdk): fixes unresolved PipelineParam when static list passed to dsl.ParallelFor. Fixes #4890 (#4891)
* fix parallelfor compiling items + add tests

* remove debug print

* fix tests

* fix parallelfor_pipeline_param_in_items_resolving test

* debug test

* fix tests

* Revert "debug test"

This reverts commit 57451143bd.

* fix tests
2021-01-14 00:09:03 -08:00
Jiaxiao Zheng 7540ba5c3b
feat(sdk): Implements artifact URI placeholder. (#4932)
* add placeholder to spec

* add output_directory to pipeline

* respect uri placeholder in file outputs

* wip: add data passing rewriting logic to respect the uri semantics

* merge input_uri and paths when instantiating ContainerOp

* fix

* fix workflow rewriting

* Add topology rewriting

* add a test case, and various fixes

* make the test case more complex

* Fix the case when working with OpsGroup

* Fix test case

* fix resolving test

* fix redundant cmd lines

* fix redundant cmd lines

* resolve comments

* fix file outputs

* resolve comments

* copy file outputs instead of modifying inplace.
2021-01-05 20:39:51 -08:00
Kenta Onishi 5a4b70e37c
feat(sdk): Add settings of the dnsConfig field. Fixes #4836 (#4837)
* feat(sdk): Add settings of the dnsConfig field. Fixes #4836

* feat(sdk): Add dnsConfig example and sample.

* feat(sdk): Refactor dnsConfig param.

* feat(sdk): Refactor dnsConfig param.
2020-12-14 20:05:49 -08:00
Vitalii Vokhmin 2f3a686e54
feat(sdk): add ability to set retry policy (#4858)
* feat(sdk): add ability to set retry policy

This fixes the second part of the issue described in #4333
The first part was addressed in #4392

* feat(sdk): validate retry policy name

* feat(sdk): simplify retry policy interface
2020-12-11 14:47:29 -08:00
Alexey Volkov f7874d38ff
fix(sdk): Compiler - Fixed pipeline parameters with empty default values (#4552)
Fixes https://github.com/kubeflow/pipelines/issues/4549
2020-11-12 15:52:28 -08:00
Alexey Volkov e8fb58a221
feat(sdk): Preserve parameter arguments and input names (#4563)
ContainerOp has no concept of inputs, so it looses any information about them such as input names and in some cases even the passed argument values (which are just injected into the command line).
This commit fixes that issue by preserving the paramater arguments map and ultimately storing it in an Argo template annotation.

Fixes https://github.com/kubeflow/pipelines/issues/4556
2020-10-11 20:32:48 -07:00
Alexey Volkov 1aa8068507
fix(sdk): DSL - Enabled arbitrary ContainerOp names (#4554)
Fixes https://github.com/kubeflow/pipelines/issues/4522
2020-09-29 05:21:35 -07:00
Niklas Hansson c32ea232d5
feat(compiled): set pod disruption budget for pipelines. Fixes #3877 (#4178)
* Update _client.py

* Update _client.py

* added pod disruption budget

* clean up

* Update sdk/python/kfp/dsl/_pipeline.py

* fixed parameter

* updated after feedback

* removed selector
2020-09-14 13:45:26 -07:00
Victor 22b7b99a8b
fix(sdk): Fix opsgroups dependency resolution (#4370) 2020-08-27 09:03:53 -07:00
Alexey Volkov db0af86e53
feat(sdk): SDK - Enable placeholders in task display names. Fixes #4163 (#4164) 2020-07-09 18:42:35 -07:00
Alexey Volkov 48889a99d1
fix(sdk): Compiler - Fixed input artifact name sanitization when using raw string arguments. Fixes #4110 (#4120) 2020-07-08 10:43:09 -07:00
Alexey Volkov 229eff2516
SDK - Compiler - Removed the deprecated dsl-compile --package command (#4055) 2020-07-01 19:12:01 -07:00
Alexey Volkov 6960366846
fix(sdk): Compiler - Fixed the input argument mapping when using dsl.graph_component. Fixes #3915 (4082)
* SDK - Compiler - Fixed the input argument mapping when using dsl.graph_component

Fixes https://github.com/kubeflow/pipelines/issues/3915

* Stopped relying on the argument order at all

This can make the compilation less fragile.
2020-06-29 02:31:37 -07:00
Jiaxiao Zheng b099c6f5d3
chore: Rollback telemetry related changes (4088)
* Revert "fix length (#3934)"

This reverts commit 7fbb7cae

* Revert "[SDK] Add first party component label (#3861)"

This reverts commit 1e2b9d4e

* Revert "[SDK] Add pod labels for telemetry purpose. (#3578)"

This reverts commit aa8da64b
2020-06-27 15:46:14 -07:00
Alexey Volkov 54a596abd8
SDK - Compiler - Added support for volume-based data passing (3371)
* SDK - Compiler - Added support for volume-based data passing

Currently artifact passing is performed by Argo sidecar containers what download input data and upload output data to artifact repository (usually, S3-compatible blob storage like Minio).
The performance of this method is not optimal and it requires that pod disks have enough capacity to hold all artifact data.

This commit adds support for volume-based data passing.
This method involves using a single milti-write Kubernetes data volume to pass all intermediate data.
Parts of the volume are mounted to the input/output artifact directories, so when the user program reads and writes files, the files actually reside in the data volume.
This method improves the performance and reduces storage resource requirements.

The data volume must exist and support "READ_WRITE_MANY".

Limitations:
* All artifact file names must be the same (e.g. "data"). All auto-generated paths are already consistent. Avoid using any hard-coded paths.
* Passing constant values (text) as arguments for artifact inputs is not supported.
* The feature is experimental.

* Added data_passing_methods.KubernetesVolume

This class represents a configured volume-based artifact passing method.

* Added PipelineConf.data_passing_method

This property allows setting the method that will be used for intermediate data passing.
Added the compiler support for the new feature.

Example:
```python
from kfp.dsl import PipelineConf, data_passing_methods
from kubernetes.client.models import V1Volume, V1PersistentVolumeClaim
pipeline_conf = PipelineConf()
pipeline_conf.data_passing_method = data_passing_methods.KubernetesVolume(
    volume=V1Volume(
        name='data',
        persistent_volume_claim=V1PersistentVolumeClaim('data-volume'),
    ),
    path_prefix='artifact_data/',
)
```

* Added unit test

* Fixed bug in the unit test

Kubernetes does not validate the structures at all...

* Fixed bug in the result structure

* Fixed the test data

The class should be V1PersistentVolumeClaimVolumeSource, not V1PersistentVolumeClaimSpec.

* Fixed the test
2020-06-25 16:11:31 -07:00
Jiaxiao Zheng 1e2b9d4e7e
[SDK] Add first party component label (#3861)
* add OOB component dict and utility function

* add test

* add a transformer, which appends the component name label

* add transformer function, compiler and test

* move telemetry test

* fix none uri

* applies comments

* revert dependency on frozendict

* fixes some tests

* resolve comments
2020-05-29 08:55:16 -07:00
Alexey Volkov 2279bde698
SDK - Annotate pods with component_ref (#3727)
* SDK - Annotate pods with component_ref

This preserves the information about the digest of the component and the location from which the component was loaded.

* Fixed compiler tests
2020-05-11 17:18:21 -07:00
Niklas Hansson 05c1537f28
Add Nodeselector to pipelineconfig fix issue #2863 (#3616)
* updated version

* added pipeline nodeselector

* removed old legacy

* renaming

* update test

* Update sdk/python/kfp/compiler/compiler.py
2020-05-05 00:11:08 -07:00
Eterna2 9167da1b4e
Support execution throttling for executing the pipelines (#3346) (#3439)
* Add parallelism limits to pipeline in kfp sdk

* fix lint error
2020-05-04 23:25:08 -07:00
Alexey Volkov 6cb92d45c8
SDK - Compiler - Include the SDK version information in the compiled workflows (#3583)
* SDK - Compiler - Include the SDK version information in the compiled workflows

* Fixed the unit tests

* Removed the sdk_version annotation.
2020-04-25 01:49:28 -07:00
Niklas Hansson 2354776e1e
fix #2802: Set ImagePullPolicy per pipeline. (#3534)
* bump version

* default image pull policy

* Update sdk/python/kfp/dsl/_pipeline.py

* task setting should dominate

* Update sdk/python/kfp/dsl/_pipeline.py

* fixed merge misstake
2020-04-23 07:09:13 -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 734b43e3db
SDK - Added support for maxCacheStaleness (#3318)
* SDK - Added support for maxCacheStaleness

* Added the vendor prefix to the annotation
2020-03-20 13:38:09 -07:00
Alexey Volkov 4a1b282461
SDK - Compiler - Fixed ParallelFor argument resolving (#3029)
* SDK - Compiler - Fixed ParallelFor name clashes

The ParallelFor argument reference resolving was really broken.
The logic "worked" like this - of the name of the referenced output
contained the name of the loop collection source output, then it was
considered to be the reference to the loop item.
This broke lots of scenarios especially in cases where there were
multiple components with same output name (e.g. the default "Output"
output name). The logic also did not distinguish between references to
the loop collection item vs. references to the loop collection source
itself.

I've rewritten the argument resolving logic, to fix the issues.

* Argo cannot use {{item}} when withParams items are dicts

* Stabilize the loop template names

* Renamed the test case
2020-02-11 12:18:09 -08:00
Jiaxiao Zheng 358e26adb1 [SDK/compiler] Sanitize op name for PipelineParam (#2711)
* sanitize op name for pipeline param

* refactor sanitization to compiler level, and add unittest
2019-12-27 18:01:39 -08:00
Alexey Volkov b8a2e6f400 SDK/Compiler - Preventing pipeline entrypoint template name from clashing with other template names (#1555)
Case exhibiting the problem:
```
def add(a, b):
    ...
@dsl.pipeline(name="add')
def some_name():
    add(...)
```
2019-12-05 18:08:49 -08:00
Alexey Volkov 1b6047aa69 SDK - Improve errors when ContainerOp.output is unavailable (#1578)
* SDK - Improve errors when ContainerOp.output is unavailable

ContainerOp.output is only available when there is only one output.
Right now, when there are multiple outputs it just holds `None` instead of the a task output reference.
In this case however it's indistinguishable from just passing None argument.
This PR gives a quick fix to make accessing the nonexistent `.output` a compile-time error.

* Fixed the implementation and added tests

* Trigger retests
2019-10-11 18:20:40 -07:00