magnificent-teacher-86590
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.tall-lock-23197
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?magnificent-teacher-86590
08/07/2023, 5:00 AMOptional[FlyteFile]
but the parent dynamic task will always return Flytefile
.tall-lock-23197
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
?magnificent-teacher-86590
08/07/2023, 5:08 AMOptional[FlyteFile]
But the dynamic task im calling needs to just return FlyteFile
magnificent-teacher-86590
08/07/2023, 5:09 AMOptional[FlyteFile]
and return FlyteFile
but that looks a bit uglymagnificent-teacher-86590
08/07/2023, 5:10 AM@task
def make_concrete_type_task(in_file: Optional[FlyteFile]) -> FlyteFile:
return in_file
tall-lock-23197
FlyteFile
in your dynamic workflow if the task's output that's being returned from the dynamic workflow is an Optional[FlyteFile]
.magnificent-teacher-86590
08/07/2023, 5:13 AMtall-lock-23197
magnificent-teacher-86590
08/07/2023, 5:21 AM