1

I have been working with Vertex AI pipelines for 3 months. I started with migrating projects from old dedicated Kubernetes infrastructure to Vertex AI Python component based pipelines. I created a template pipelines which were running fine until last week. I recently made some changes and my pipeline fails giving me the error message Failed to evaluate the expression with error: UNKNOWN: No value with name "True" found in Activation; Failed to evaluate the TriggerPolicy.condition field.
My pipeline definition looks as follows

@kfp.v2.dsl.pipeline(name="my-custom-pipeline-name", )
def my_pipeline_new(
                     ENV: str = "dev",
                     ISO_CODE_COUNTRY: str = "DE",
                     DEFAULT_TRUE_FLAG: bool=True,
                     ENABLE_PERSIST_RESULTS:bool= True,
                     SOME_FLAG: bool = True

                    ):   

    with kfp.v2.dsl.Condition(DEFAULT_TRUE_FLAG==True) as C1:
        with kfp.v2.dsl.Condition(SOME_FLAG== True):
            some_module_obj = some_python_based_component(env=ENV, iso_code= ISO_CODE_COUNTRY, enable_persist_results= ENABLE_PERSIST_RESULTS)
    

My current KFP version is 1.7.0. I am totally lost here to find out why my pipeline has suddenly stopped working.

Could there any possibility that some upgrades occurred in Vertex AI Pipelines that I am unaware of?
Any suggestions / ideas would be much appreciated.

I have been doing trial and error methods to see but my pipeline does not even triggers and it fails in the beginning phase. When I try to run my python based component without any conditions it runs totally fine but with conditions it is just failing.

To make sure my suspicion is correct, I made a dummy pipeline which also seems to fail with dsl conditions.

import kfp
from kfp.v2.dsl import (
    component,
    Dataset,
    Input,
    Output,
    Metrics,
    Artifact,
    ClassificationMetrics,
    Model,
    Metrics,
    Dataset,
    OutputPath,
    InputPath,
    Condition,
)

@component
def component_A(flag: bool):
    if flag:
        print("Flag is true.")
    else:
        print("Flag is false.")

@component
def component_B():
    print("Running component B.")

@kfp.dsl.pipeline(
    name="conditional-pipeline",
    description="A simple pipeline with a condition",
    pipeline_root="gs:bucket-name"
)
def my_pipeline(flag: bool = True):
    with Condition(flag == True):
        a = component_A(flag)
    b = component_B()

PIPELINE_ROOT = "{}/pipeline_root".format("MY-GCS-BUCKET")

Here is the snippet of pipeline which fails and throws error:
Simple Condition Code Failing

greybeard
  • 2,249
  • 8
  • 30
  • 66

1 Answers1

0

VertexAI is growing very fast and unfortunetly with few documentation and few people using it! There are many broken and not working modules and codes related to VertexAI as well such as this problem and modules like Batch Prediction.

A possible way to resolve your error (not very clean) would be using the output of a component like this:

...
**@component
def set_flag(flag: bool):
    
return flag**

@kfp.dsl.pipeline(
    name="conditional-pipeline",
    description="A simple pipeline with a condition",
    pipeline_root="gs:bucket-name"
)
def my_pipeline(flag: bool = True):
    **result = set_flag(flag)**
    with Condition(
                **result.output == True,**
                name = 'check flag?'):

        a = component_A(flag)
    b = component_B()
...

You can also check the working example in GCP github : link

Amirkhm
  • 948
  • 11
  • 13
  • Thanks alot, this works too. I raised a ticket for this as well in GCP forum at P2 and seems like the boolean flag was somehow marked as unavailable. For time being I adjusted the flags to str and explicitly declared them as "True" but thanks for your solution this might work too for me – Pawan Kumar May 19 '23 at 09:53