cuddly-jelly-27016
05/27/2025, 12:09 AMdef test_condition_is_none2():
@dataclass
class MyDataClass(DataClassJSONMixin):
a: int
b: str
@task
def maybe_str(a: int) -> typing.Optional[MyDataClass]:
if a > 5:
return MyDataClass(a=a, b="hello")
return None
@task
def failed() -> int:
return 10
@task
def success() -> int:
return 20
@workflow
def decompose_unary() -> int:
result = maybe_str(a=6)
return conditional("test").if_(result.is_none()).then(success()).else_().then(failed())
xx = decompose_unary()
print(xx)
Currently it is producing an error
ValueError: Only primitive values can be used in comparison
While it makes sense that propeller in the back can only check primitives, I think we can make an exception for optional/none.
### Are you sure this issue hasn't been raised already?
• Yes
### Have you read the Code of Conduct?
• Yes
flyteorg/flytecuddly-jelly-27016
05/27/2025, 12:09 AM