Great to see that with kfp v2 we can now have if .. else block and use Boolean. While I am trying to migrate my v1 pipelines, I have few question
I am using kfp
2.7.0
and google-cloud-pipeline-components
2.15.0
How that I set a task group name in a dsl.If block ? I am the following test code:
# simulate hyper parameter tuning task
with (dsl.If(cond == False,
name="if condition")):
cond_1 = print_text_component(text="text_one").set_display_name("Print if condition is False")
# simulate training task
with (dsl.Else(name="else condition")):
cond_2 = print_text_component(text="text_two").set_display_name("Print if condition is True")
oneof = dsl.OneOf(cond_1.output, cond_2.output)
get_sentence_task_end = (
print_text_component(text=oneof).set_display_name("At the end")
)
and this is of the pipeline is display using Vertex AI pipeline (GCP):
I don’t create this group so I am not sure how I can rename if or how I can create myself. This was briefly discussed here https://github.com/kubeflow/pipelines/issues/10274 it is unclear to me if it exist a solution or not. Here what I could fine in the json file
My second question is related to the syntax dsl.If(cond == False)
which doesn’t seems to be very pythonic (PEP 8: E712) but none of dsl.If(not cond)
or dsl.If(cond is False)
give the following error:
ValueError: Got constant boolean False as a condition. This is likely because the provided condition evaluated immediately. At least one of the operands must be an output from an upstream task or a pipeline parameter.