https://prefect.io logo
Title
a

Avi A

04/30/2020, 3:12 PM
Using dataclasses as inputs/outputs: I’m trying to pass Python dataclasses between tasks, but I’m getting JSON serialization errors (naturally because they are… well.. not JSON serializable. Any ideas for how to tackle this issue? Ideally if there’s a way to supply custom ser/deser functions, that’d be perfect
👀 1
l

Laura Lorenz (she/her)

04/30/2020, 3:20 PM
Hi! I didn’t think we enforced JSON serialization for return values across the board, only in certain configuration situations, can you share a little bit more about how your tasks are configured and/or the traceback itself?
a

Avi A

04/30/2020, 3:48 PM
I changed the code and I now output dicts/tuples instead. it happened in mapped tasks
I may recreate and share the logs
l

Laura Lorenz (she/her)

04/30/2020, 4:35 PM
@Avi A ok great, basically I would only expect Prefect to do JSON serialization for you if you had set up your tasks to use JSONResultHandlers, or the tasks in question were Parameters, so if you do get to a recreating the traceback sometime maybe it will give me a canary of what is going on here 🙂