New RunLLM response generated: >>>*# Question* We...
# runllm-flyte-trial
j
New RunLLM response generated: >>>*# Question* We've got a task that takes a list of DataClasses(see contrived example below), and are seeing this error - https://github.com/flyteorg/flytekit/blob/master/flytekit/core/type_engine.py#L1580. Can the
ListTransformer
be made to handle this case in the future? Or do we need to create a TypeTransformer specifically for
list[Foo]
?
Copy code
@dataclass_json
@dataclass
class Foo:
    val: str

@task
def foos_task(foos: list[Foo]) -> None:
    ....
It's also really strange because we are definitely able to handle lists of dataclasses as workflow arguments we use for subworkflows without any issue
Copy code
@workflow
def sub_wf(foos: list[Foo]) -> None:
    ....
# Answer The issue you're encountering with handling lists of dataclasses in tasks may be related to Flyte's current limitations in handling such data structures. According to this GitHub issue, there are known challenges with deserialization when using dataclasses with lists, especially when using postponed evaluation. The
ListTransformer
in Flyte may not fully support lists of dataclasses, which could be causing the error you're seeing. To address this, you might need to implement a custom
TypeTransformer
for
list<https://docs.flyte.org/en/latest/user_guide/flyte_fundamentals/extending_flyte.html#customizing-flyte-types|Foo]
. This approach is suggested in the [Flyte documentation>, which explains how to create custom types to handle serialization and deserialization explicitly. This would allow you to define how lists of your dataclass
Foo
should be transformed when passed between tasks. Would you like more detail on how to implement a custom
TypeTransformer
for your use case? Sources: - GitHub Issue 4004 - Customizing Flyte Types Slack Link https://.slack.com/archives/CP2HDHKE1/p1730498307.566449 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.