kubeflow / pipelines

Machine Learning Pipelines for Kubeflow
https://www.kubeflow.org/docs/components/pipelines/
Apache License 2.0
3.5k stars 1.57k forks source link

[sdk] Not possible to conditionally trigger cache #10959

Open AndersBennedsgaard opened 4 days ago

AndersBennedsgaard commented 4 days ago

Environment

Steps to reproduce

I was trying to trigger caching using the .set_caching_options field of the returned components, as explained here: https://www.kubeflow.org/docs/components/pipelines/user-guides/core-functions/caching/ However, I want to have control when it is disabled/enabled, so I tried to use something like the following:

from kfp import compiler
from kfp import dsl

@dsl.component(base_image="python:3.8")
def say_hello(name: str) -> str:
    hello_text = f'Hello, {name}!'
    print(hello_text)
    return hello_text

@dsl.pipeline
def pipeline(enable_caching: bool):
    hello_task = say_hello(name="World")
    hello_task.set_caching_options(enable_caching)

compiler.Compiler().compile(pipeline, "pipeline.yaml")

On KFP SDK v2.8.0 this returns a TypeError: 'PipelineParameterChannel' object cannot be interpreted as an integer A similarly sounding error is returned on lower versions

Expected result

It should be able to optionally trigger caching

Materials and Reference


Impacted by this bug? Give it a 👍.