[BUG] FlyteKit's ImageSpec results in unexpected behavior with incorrect "packages" argument type. #5632
Closed
2 tasks done
Labels
bug
Something isn't working
Describe the bug
If one were to pass a string to the
packages
argument ofImageSpec
, they will get a similar error to the following (I accidentally passed in"requirements.txt"
:Expected behavior
There appears to be no type assertion on the
packages
argument, such thatImageSpec
will literally "iterate" over all of the values of the input.This results in unexpected behavior, but could be improved with couple of simple type assertions:
isinstance(packages, list)
all(isinstance(package, str) for package in packages)
Should these assertions fail, then I would expect a more human-friendly error message, such as an invalid input type.
Additional context to reproduce
import flytekit as fk
image = fk.ImageSpec(builder="unionai", packages="requirements")
@fk.task(container_image=image)
def my_task(my_value: str) -> None:
print(my_value)
Screenshots
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: