pipelines icon indicating copy to clipboard operation
pipelines copied to clipboard

[bug] Cannot reuse the same components in different nested pipelines

Open roytman opened this issue 7 months ago • 0 comments

Environment

  • How do you deploy Kubeflow Pipelines (KFP)? OpenShift AI

  • KFP version: rhods-operator.2.10.0,

  • KFP SDK version: kfp 2.7.0 kfp-kubernetes 1.2.0 kfp-pipeline-spec 0.3.0 kfp-server-api 2.0.5

Steps to reproduce

Create a pipeline with 2 nested pipelines that reuse the same components. When the pipeline is deployed, only one nested pipeline shows the inner components, the second one is empty, see the picture.

Expected result

These nested pipelines should show all their inner components and be independent.

Materials and reference

import kfp.compiler as compiler
import kfp.dsl as dsl

@dsl.component(base_image='python:3.10')
def square(x: float) -> float:
    return x ** 2

@dsl.component(base_image='python:3.10')
def add(x: float, y: float) -> float:
    return x + y

@dsl.component(base_image='python:3.10')
def square_root(x: float) -> float:
    return x ** .5

@dsl.pipeline
def square_and_sum(a: float, b: float) -> float:
    a_sq_task = square(x=a)
    b_sq_task = square(x=b)
    return add(x=a_sq_task.output, y=b_sq_task.output).output

@dsl.pipeline
def another_square_and_sum(a: float, b: float) -> float:
    a_sq_task = square(x=a)
    b_sq_task = square(x=b)
    return add(x=a_sq_task.output, y=b_sq_task.output).output

@dsl.pipeline
def pythagorean(a: float = 1.2, b: float = 1.2) -> float:
    sq_and_sum_task = square_and_sum(a=a, b=b)
    sq_and_sum_task2 = another_square_and_sum(a=a, b=b)
    if sq_and_sum_task.output == sq_and_sum_task2.output:
        return square_root(x=sq_and_sum_task.output).output
    else:
        return -1.0

if __name__ == "__main__":
    # Compiling the pipeline
    compiler.Compiler().compile(pythagorean, __file__.replace(".py", ".yaml"))
image

Labels


Impacted by this bug? Give it a 👍.

roytman avatar Jun 30 '24 19:06 roytman