Skip to content

Upgrade TorchX to Support Kubeflow Pipelines v2 #1073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chethanuk
Copy link

KFP v1 has been deprecated for a while now, and we really needed to get onto the newer version of the KFP SDK, so we are migrating KFP v1 to the v2 API

Key Changes

Dependencies

  • kfp: 1.8.22>=2.8.0
  • Added kfp-kubernetes>=1.4.0 for K8s-specific features
  • protobuf: 3.20.3>=4.21.0 (KFP v2 requirement)

Core Adapter (adapter.py)

  • Complete refactor to use KFP v2 APIs
  • Replaced ContainerOp with @dsl.component decorator pattern
  • container_from_app now returns PipelineTask instead of ContainerOp
  • Enhanced GPU/accelerator configuration support
  • Improved resource limits and env var handling

Version Handling

  • Changed from blocking KFP v2 to showing deprecation warning for v1 users
  • Warning: "KFP version 1.x.x is deprecated! Please upgrade to kfp version 2.x.x"

Examples & Tests

  • Updated all existing pipeline examples for KFP v2 patterns
  • Added new examples showcasing v2 features (retry policies, caching, PVC management)
  • Comprehensive test coverage with new integration tests

Breaking Changes

# 1. Import Changes: Components using TorchX KFP adapter need to update imports:
# Old (KFP v1)
from kfp import dsl
from kfp.compiler import Compiler

# New (KFP v2)  
from kfp import compiler, dsl

# 2. Component Creation: The adapter now returns PipelineTask instead of ContainerOp
# Old
task = container_from_app(app)  # Returns ContainerOp
task.container.set_tty()

# New
task = container_from_app(app)  # Returns PipelineTask
task.set_display_name("My Task")

# 3. Pipeline Compilation: Must use keyword arguments
# Old
compiler.Compiler().compile(pipeline, "pipeline.yaml")

# New
compiler.Compiler().compile(pipeline_func=pipeline, package_path="pipeline.yaml")

Migration

  1. Update to kfp>=2.8.0
  2. Use KFP v2 patterns (see updated examples)
  3. Replace .after() with proper task dependencies or use the KFP v2 .after() method
  4. Use ``set_display_name()` instead of container property manipulation

Test plan:
image

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants