<#5676 Easier conditional none check> Issue create...
# flyte-github
c
#5676 Easier conditional none check Issue created by wild-endeavor ### Describe the issue This sample code should work
Copy code
def 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
Copy code
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/flyte