Hello. Is there no builtin mechanism for serializi...
# flyte-support
m
Hello. Is there no builtin mechanism for serializing
TypeVar
instances? If not are there any recommendations to handle them?
a
@mammoth-artist-36380 I think this PR introduced support for using
typing.Annotated
instead
m
It's hard for me to tell, is this specific to
FlyteFile
?
f
What do you mean type at instances can you share an example
m
We actually found the issue here. It happens when a task has an input / output that includes a generic
TypeVar
. These get added to the task
Interface
which gets passed down the stack and handed to
to_python_value
expected_python_type
on a custom
TypeTransformer
. At serialization time, the actual type is known in place of the
TypeVar
but during deserialization, our deserializer was getting confused because it was trying to deserialize to the
TypeVar
instead of the concrete type since that's what comes in to
to_python_value
. The workaround we found is to explicitly serialize the concrete type information in place of the
TypeVar
alongside the serialized object and then ignore the type information passed into
to_python_value
and instead use the serialized type information.