Closed ittus closed 3 months ago
Thanks for reporting this @ittus. This is a known bug.
Any update on this? We'd like to use the dsl.Condition to trigger some alert ops and can't whilst this is open.
This has not yet been fixed in KFP v1.
This was fixed at least as early as kfp==2.0.0b1
. The following runs without issue:
import kfp
assert kfp.__version__ == '2.0.0b1'
from kfp import compiler
from kfp import dsl
@dsl.component
def identity(string: str) -> str:
return string
@dsl.pipeline()
def my_pipeline(string: str = 'string'):
with dsl.Condition(string == 'string'):
op1 = identity(string=string)
ir_file = __file__.replace('.py', '.yaml')
compiler.Compiler().compile(pipeline_func=my_pipeline, package_path=ir_file)
That may run, however anything beyond a trivial equality (like checking if a file needs to be decompressed by checking a file extension) fails due to PipelineParameterChannel attribute issues. This seems related to #8626 and essentially prevents me from using kubeflow pipelines in a production setting.
@MatthewRalston, thanks for your response. If I understand what you're describing correctly, that's independent from the use of pipeline input in dsl.Condition
.
But yes, only a limited number of operators are permitted in dsl.Condition
. Arbitrary user code is not permitted in dsl.Condition
(or the pipeline body more generally) since the pipeline body defines the orchestration and will not actually be run at pipeline runtime.
I am also getting the same error message as long as the condition is not based on the PipelineParam, e.g.
a_local_variable=5
with dsl.Condition(a_local_variable == 5):
pass
AttributeError: 'bool' object has no attribute 'operand1'
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had recent activity. Please comment "/reopen" to reopen it.
Environment
How do you deploy Kubeflow Pipelines (KFP)? Full Kubeflow deployment
KFP version: 1.8.1
KFP SDK version: 1.8.12
Steps to reproduce
Then there is an error when create the pipeline
If I change the condition to
then when running, there is another error
Expected result
Materials and reference
Labels
/area sdk
Impacted by this bug? Give it a 👍.