damp-lion-88352
09/04/2024, 5:15 PMJSON IDL
.
I’d like to have an async discussion regarding the JSON IDL implementation.
Currently, we’re using Solution 1, but I want to compare it with Solution 2.
Solution 1
1. Encode: python val → JSON string → msgpack bytes
2. Decode: msgpack bytes → JSON string → python val
Solution 2
1. Encode: python val → msgpack bytes
2. Decode: msgpack bytes → python val
Comparison
1. Performance: Solution 2 is lighter and faster than Solution 1.
2. Speed: [PR comment](https://github.com/flyteorg/flyte/pull/5607#issuecomment-2329179934)
3. Size: [PR comment](https://github.com/flyteorg/flyte/pull/5607#issuecomment-2329375392)
Other Considerations
1. Solution 1 is reliable and proven to avoid additional issues, whereas Solution 2 still needs to resolve certain problems. (See related [PR](https://github.com/flyteorg/flytekit/pull/2613)) There’s an open issue in the mashumaro repo regarding Solution 2
, but it may take time as the author is currently on vacation.
2. Solution 2 doesn’t support Pydantic at the moment, so one workaround is to first convert the Pydantic BaseModel
to a JSON string, and then to msgpack bytes (e.g., python val → JSON string → msgpack bytes). However, this introduces complexity, as both the Flyte backend and FlyteConsole would need to support two different methods of deserialization.
Looking forward to your thoughts on this!
Thank you all.
cc @cool-lifeguard-49380 @damp-rain-31363damp-rain-31363
09/04/2024, 7:43 PMdamp-lion-88352
09/05/2024, 3:05 AMdamp-lion-88352
09/05/2024, 3:07 AMdamp-lion-88352
09/05/2024, 4:48 AMmsgpack
to serialize strings, we can't get any benefit from it.damp-lion-88352
09/05/2024, 2:57 PMdamp-lion-88352
09/05/2024, 2:57 PMdamp-lion-88352
09/05/2024, 2:57 PMdamp-lion-88352
09/05/2024, 2:57 PMdamp-lion-88352
09/06/2024, 3:43 AMCreate a new IDL type called JSON
or re-use Binary IDL
.
here is the full description.
I would like to know how you think, thank you all.
https://github.com/flyteorg/flyte/pull/5607#issuecomment-2333174325damp-lion-88352
09/10/2024, 4:16 AM