Previous usage | -New usage | -
---|---|
- -```python -from kfp.v2 import dsl -from kfp.v2 import compiler - -@dsl.pipeline(name='my-pipeline') -def pipeline(): - ... - -compiler.Compiler().compile(...) -``` - - | -- -```python -from kfp import dsl -from kfp import compiler - -@dsl.pipeline(name='my-pipeline') -def pipeline(): - ... - -compiler.Compiler().compile(...) -``` - - | -
Previous usage | -New usage | -
---|---|
- -```python -from kfp.v2.dsl import component - -@component(output_component_file='my_component.yaml') -def my_component(input: str): - ... -``` - - | -- -```python -from kfp.dsl import component -from kfp import compiler - -@component() -def my_component(input: str): - ... - -compiler.Compiler().compile(my_component, 'my_component.yaml') -``` - - | -
Previous usage | -New usage | -
---|---|
- -```python -from kfp.v2 import compiler -# .json extension, deprecated format -compiler.Compiler().compile(pipeline, package_path='my_pipeline.json') -``` - - | -- -```python -from kfp import compiler -# .yaml extension, preferred format -compiler.Compiler().compile(pipeline, package_path='my_pipeline.yaml') -``` - - | -
Previous usage | -New usage | -
---|---|
- -```python -from kfp.components import importer_node -``` +The following table shows which versions of KFP backend are included in each version of Kubeflow Platform: - | -+Release Date | Kubeflow Platform Version | KFP Backend Version | SDK Mode: [`v1`](/docs/components/pipelines/legacy-v1/sdk/) | SDK Mode: [`v2`](/docs/components/pipelines/user-guides/core-functions/compile-a-pipeline/) | SDK Mode: [`v2-compatible`](https://v1-7-branch.kubeflow.org/docs/components/pipelines/v1/sdk-v2/) +--- | --- | --- | --- | --- | --- +2024-07-22 | [Kubeflow 1.9](/docs/releases/kubeflow-1.9/) | [2.2.0](https://github.com/kubeflow/pipelines/releases/tag/2.2.0) | | | +2023-11-01 | [Kubeflow 1.8](/docs/releases/kubeflow-1.8/) | [2.0.3](https://github.com/kubeflow/pipelines/releases/tag/2.0.3) | | | +2023-03-29 | [Kubeflow 1.7](/docs/releases/kubeflow-1.7/) | [2.0.0-alpha.7](https://github.com/kubeflow/pipelines/releases/tag/2.0.0-alpha.7) | | | +2022-10-10 | [Kubeflow 1.6](/docs/releases/kubeflow-1.6/) | [2.0.0-alpha.5](https://github.com/kubeflow/pipelines/releases/tag/2.0.0-alpha.5) | | | +2022-06-15 | [Kubeflow 1.5](/docs/releases/kubeflow-1.5/) | [1.8.2](https://github.com/kubeflow/pipelines/releases/tag/1.8.2) | | | -```python -from kfp.dsl import importer_node -``` +## Backward Compatibility - | -
Previous usage | -New usage | -
---|---|
+## Migration Paths -```python -@dsl.pipeline -def my_pipeline(): - task.add_node_selector_constraint( - label_name='cloud.google.com/gke-accelerator', - value='NVIDIA_TESLA_A100', - ) -``` +How you migrate to KFP V2 will depend on your current SDK version and usage. - | -+There are two common migration paths: -```python -@dsl.pipeline -def my_pipeline(): - task.set_accelerator_type(accelerator="NVIDIA_TESLA_K80") -``` +1. [__SDK v1__ → __SDK v2__](#migrate-from-sdk-v1-to-sdk-v2) +2. [__SDK v1 (v2-namespace) → SDK v2__](#migrate-from-sdk-v1-v2-namespace-to-sdk-v2) - | -
Previous usage | +New usage | +
---|---|
+ +```python +from kfp.v2 import dsl +from kfp.v2 import compiler + +@dsl.pipeline(name='my-pipeline') +def pipeline(): + ... + +compiler.Compiler().compile(...) +``` + + | ++ +```python +from kfp import dsl +from kfp import compiler + +@dsl.pipeline(name='my-pipeline') +def pipeline(): + ... + +compiler.Compiler().compile(...) +``` + + | +
Previous usage | +New usage | +
---|---|
+ +```python +from kfp.v2.dsl import component + +@component(output_component_file='my_component.yaml') +def my_component(input: str): + ... +``` + + | ++ +```python +from kfp.dsl import component +from kfp import compiler + +@component() +def my_component(input: str): + ... + +compiler.Compiler().compile(my_component, 'my_component.yaml') +``` + + | +
Previous usage | +New usage | +
---|---|
+ +```python +from kfp.v2 import compiler +# .json extension, deprecated format +compiler.Compiler().compile(pipeline, package_path='my_pipeline.json') +``` + + | ++ +```python +from kfp import compiler +# .yaml extension, preferred format +compiler.Compiler().compile(pipeline, package_path='my_pipeline.yaml') +``` + + | +
Previous usage | +New usage | +
---|---|
+ +```python +from kfp.components import importer_node +``` + + | ++ +```python +from kfp.dsl import importer_node +``` + + | +
Previous usage | +New usage | +
---|---|
+ +```python +@dsl.pipeline +def my_pipeline(): + task.add_node_selector_constraint( + label_name='cloud.google.com/gke-accelerator', + value='NVIDIA_TESLA_A100', + ) +``` + + | ++ +```python +@dsl.pipeline +def my_pipeline(): + task.set_accelerator_type(accelerator="NVIDIA_TESLA_K80") +``` + + | +