<#3036 fix: add FlyteValueException handling and c...
# flyte-github
a
#3036 fix: add FlyteValueException handling and clean up exit_handler calls Pull request opened by vincent0426 Tracking issue Why are the changes needed? Currently, if a task returns a value but does not specify a return type, the return value will be empty instead of raising an error. It is expected to raise an error if a function returns a value but no return type is specified. This should throw an error, but it doesn't
pyflyte run example.py greeting_length --greeting="hello"
@task() def greeting_length(greeting: str): """A task the counts the length of a greeting.""" return len(greeting) Screenshot 2025-01-05 at 8 57 25 PM What changes were proposed in this pull request? Add conditions check to throw an error if
native_outputs
have value but no output interface is specified How was this patch tested? Setup process
pyflyte run example.py greeting_length --greeting="hello"
@task() def greeting_length(greeting: str): """A task the counts the length of a greeting.""" return len(greeting) Screenshots Screenshot 2025-01-05 at 8 58 41 PM Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. Related PRs Docs link Summary by Bito Implementation of enhanced error handling for tasks with undefined/unspecified return types, introducing FlyteValueException for validation of native outputs. Added comprehensive test cases covering regular returns, optional types, and error scenarios. Enhanced test coverage for task return type handling mechanisms and improved validation in test files to prevent silent failures. Optimized exit_handler calls in VSCode and Jupyter environments for better type safety. Unit tests added: True Estimated effort to review (1-5, lower is better): 1 flyteorg/flytekit