important-hamburger-34837
08/11/2024, 3:12 PMfailed to compile workflow for [resource_type:WORKFLOW project:"projectneame" domain:"development" name:"flyte.workflows.wf.wf" version:"test"] with err failed to compile workflow with err Collected Errors: 1
Error 0: Code: ValueRequired, Node Id: n1, Description: Value required [RightValue.Val].
my code looks something like this
csv_file = get_file(dir: FlyteDirectory ...) -> Optional[FlyteFile]
resulsts = (
conditional("con")
.if_(csv_file == None) # or if_(csv_file.is_none())
.then(noop())
.else_()
.then(subwf(csv_file))
)
what does is_none mean? cant it handle Optional inputs? how to solve this issue here without introducing another task that returns a boolean ?tall-lock-23197
is_none
doesn't work on promises and the output types of the then
nodes must be the same.important-hamburger-34837
08/12/2024, 7:24 AMimportant-hamburger-34837
08/12/2024, 11:14 AMis_true()
and is_false()
thankful-minister-83577
important-hamburger-34837
08/13/2024, 5:03 PMimportant-hamburger-34837
08/13/2024, 5:03 PMthankful-minister-83577
important-hamburger-34837
08/13/2024, 5:05 PMthankful-minister-83577
thankful-minister-83577
thankful-minister-83577
thankful-minister-83577
ValueError: Only primitive values can be used in comparison
thankful-minister-83577
important-hamburger-34837
08/13/2024, 5:08 PMimportant-hamburger-34837
08/13/2024, 5:08 PMthankful-minister-83577
thankful-minister-83577
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)
acceptable-accountant-9776
08/19/2024, 3:33 PMimportant-hamburger-34837
08/19/2024, 3:34 PMacceptable-accountant-9776
08/19/2024, 3:37 PMimportant-hamburger-34837
08/19/2024, 3:37 PMdef task() -> Tuple[Optional[FlyteFile], bool]:
f = get_file()
exists = f is not None # or whatever
return f, exists
@workflow
def wf():
csv_file, exists = task(dir: FlyteDirectory ...)
resulsts = (
conditional("con")
.if_(exists.is_false())
.then(noop())
.else_()
.then(subwf(do sometrhing...))
)