-
Notifications
You must be signed in to change notification settings - Fork 750
Open
Labels
bugSomething isn't workingSomething isn't workinguntriagedThis issues has not yet been looked at by the MaintainersThis issues has not yet been looked at by the Maintainers
Description
Flyte & Flytekit version
flytekit 1.16.3
Describe the bug
from flytekit import workflow, task
from pydantic import BaseModel
class M(BaseModel):
pass
class C(BaseModel):
xs: list[M] = []
@task
def f(x: list[M]) -> None:
print(x)
@task
def z() -> C:
return C()
@workflow
def d() -> None:
f(z().xs)
if __name__ == "__main__":
d()
Running gives error:
TypeTransformerFailedError: Error encountered while executing 'bug.d':
Error encountered while converting inputs of 'bug.f':
Error converting input 'x' at position 0:
Literal value: Flyte Serialized object (Literal):
scalar:
binary:
value: b'\x90'
tag: msgpack
Expected Python type: list[__main__.M]
Exception: Field "" of type M in __root__ is not serializable
Expected behavior
I'd expect that code to work without failure and print an empty list.
It has something to do with the fact that the z().xs
gives a literal scalar containing msgpack of a list of dicts. If I'd have done
def d():
f(C())
then the literal given to f
is instead a literal of a collection of msgpacks of a dict. This is handled correctly by the type engine.
Additional context to reproduce
No response
Screenshots
No response
Are you sure this issue hasn't been raised already?
- Yes
Have you read the Code of Conduct?
- Yes
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinguntriagedThis issues has not yet been looked at by the MaintainersThis issues has not yet been looked at by the Maintainers
Type
Projects
Status
Backlog