Closed guzzijones closed 3 years ago
It turns out orjson will not dump sets like the previous code did. https://github.com/StackStorm/st2/blob/940219703f420df940938bfa342ba58c3a3ad85e/st2common/st2common/fields.py#L464
Good catch - we should also start adding some tests for this functionality (aka serializing sets - it's weird we had no existing orquesta or similar test which would have caught that).
I am not sure where to fix this? It doesn't look like orjson can have a custom serializer for dict inputs.
maybe this 'default' parameter: https://github.com/ijl/orjson#default I will try it
yup that works. PR incoming
I am going to add a unit test for this.
Since this is a performance critical change, we also need a good set of micro benchmarks for it (can extend existing ones to cover new situations and various sizes with mixed types + sets).
IIRC, using custom serializer / default adds (some) overhead, but microbenchmarks results should answer that objectively and then we can decide how to proceed (since set is not used frequently and likely only in orquesta workflow it may actually make sense to fall back on orjson.dumps with custom serialization / defaults in case standard orjson.dumps throws or similar).
ok I added a PR https://github.com/StackStorm/st2/pull/5267
SUMMARY
.toSet()
yaql is no longer serialized to json by the workflow engine. Provide a quick summary of your bug report. While running a workflow with large input json I stumbled upon this serialization error for the workflow engine.STACKSTORM VERSION
st2 3.5dev (7af7122), on Python 3.6.8
OS, environment, install method
Centos 7
Steps to reproduce the problem
Create a workflow with a yaql statement that outputs a set
.toSet()
ie
Expected Results
Workflow does not fail
Actual Results
workflow fails