Jay Ganbat
08/04/2023, 5:15 PMtask_with_optional_return
returns optional FlyteFile
• dynamic_task
that calls above task BUT returns regular FlyteFile
How do i cleanly resolve this optional types.
For now i had to create a temporary task that takes in Optional[FlyteFile]
and return Flytefile
but creating an entire new task just for this type conversion is just a bit ugly 😅
unfortunately i cannot check for `None`because during runtime compilation return type of task_with_optional_return
is Promise.Samhita Alla
Optional[FlyteFile]
from your task, why do you want to set the type to FlyteFile
while returning the same in a dynamic workflow? Does your task always return a FlyteFile
, meaning, is it not necessary to check for None
return type?Jay Ganbat
08/07/2023, 5:00 AMOptional[FlyteFile]
but the parent dynamic task will always return Flytefile
.Samhita Alla
Optional[FlyteFile]
, correct? But there's this dynamic workflow where you want to return FlyteFile
. How do you know beforehand if your task is going to return a FlyteFile
or a None
?Jay Ganbat
08/07/2023, 5:08 AMOptional[FlyteFile]
But the dynamic task im calling needs to just return FlyteFile
Optional[FlyteFile]
and return FlyteFile
but that looks a bit ugly@task
def make_concrete_type_task(in_file: Optional[FlyteFile]) -> FlyteFile:
return in_file
Samhita Alla
FlyteFile
in your dynamic workflow if the task's output that's being returned from the dynamic workflow is an Optional[FlyteFile]
.Jay Ganbat
08/07/2023, 5:13 AMSamhita Alla
Jay Ganbat
08/07/2023, 5:21 AM