[Core feature] Flytekit create automatic bindings for Task default values
Motivation: Why do you think this is important?
Currently this will not work, as rotation is not provided
@task(cache=True, cache_version="1")
def rotate_image(img: FlyteFile, rotation: int = 180) -> FlyteFile:
img.download()
with Image.open(img.path) as im:
rotated = im.rotate(rotation)
rotated.save("/tmp/rotated.jpeg")
return FlyteFile("/tmp/rotated.jpeg")
@workflow
def wf(img: FlyteFile = "testdir/maradona.jpeg") -> FlyteFile:
return rotate_image(img=img)
Goal: What should the final outcome look like, ideally?
Ideally we should automatically create a node binding in the workflow where the default value in the task inputs should be added to the node in the workflow
Describe alternatives you've considered
NA
Propose: Link/Inline OR Additional context
No response
Are you sure this issue hasn't been raised already?
- [X] Yes
Have you read the Code of Conduct?
- [X] Yes
### Tasks
Will start it after 5/12, thank you
The issue you're describing relates to the current limitation in Flyte where default values for task inputs are not automatically recognized and used in workflows. This is a known limitation, as discussed in GitHub issue #2426, where the Flyte type system does not automatically bind default values or None for optional variables unless explicitly provided. This behavior is intentional to ensure explicitness in workflow definitions.
Your proposed feature to automatically create node bindings for default task input values in workflows would require changes to the FlyteIDL and the core handling of task and workflow interfaces. This feature could simplify workflow definitions by reducing the need for explicit default value bindings at the workflow level, aligning task behavior more closely with standard Python function behavior.
Would you like more detail on how this could be implemented or the current discussions around this feature?
Sources:
- Support for Optional value types in Tasks
- And launchplans seem the only way to specify default values
- Me again I have a question about default parameters
This is an AI-generated response and your feedback is appreciated! Please leave a 👍 if this is helpful and 👎 if it is not.
Mention @runllm to ask follow-up questions. See runllm.com for more!
#take