[Core feature] Support for Optional value types in Tasks #2426
Labels
enhancement
New feature or request
untriaged
This issues has not yet been looked at by the Maintainers
Milestone
Motivation: Why do you think this is important?
Recently UnionTypes were added to Flyte by the Latch team.
Though they are really powerful, it does introduce some complexity in how the type system handles it.
One of the powerful features is that it can support optional types easily. Optional types are of the form
Optional<int>
.Optional types are great as they help in interface evolution.
Define: Interface evolution
Assume we have one task with the following interface
Now if a workflow references this task, but at some point the original maintainer of the task wants to update the task without affecting the other users of the task. Today Flyte supports this using version pinning. But, what if we want to update the versions?
This can be handled in one of two ways, either by supporting
Optional
types and ordefault values
. Optional types is a simplification of default values with only None as the supported default.Thus it would be easy to modify the above interface now
OR
But, in the currently type system, Flyte type system, it is expected that the
z
value is bound from an upstream variable or a default is explicitly provided to the node.A better approach would be that the platform automatically substitutes the default values or None for all optional variables, if not bound explicitly
Moreover,
python automatically converts the following into a Optional type
and optional is only represented as a union
Thus now the users need to pass unions to all tasks, without automatically binding None
Goal: What should the final outcome look like, ideally?
remote tasks should automatically get None values if not specified
Describe alternatives you've considered
NA
Propose: Link/Inline OR Additional context
No response
Are you sure this issue hasn't been raised already?
Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: