Skip to content

Conversation

@xuru
Copy link

@xuru xuru commented Dec 30, 2017

Allows for custom serialization/deserialization and defaults to the built json encoder/decoder. This also sets the encoder/decoder for all places json.dump(s) and json.load(s) is used (i.e. gen_unique_id).

This allows you to use a custom encoder/decoder and still use unique=True on tasks.

TODO: add tests, and docs

Better json serialization/deserialization
@thomasst
Copy link
Member

thomasst commented Jan 4, 2018

Thanks! Any downside on doing it the way #92 or #22 do it? Those give additional flexibility since they allow for encoders/decoders other than JSON.

@xuru
Copy link
Author

xuru commented Jan 5, 2018

No downside, but I'm using flask/jinja2 and I just use the same encoder/decoder here.

One thing we could do, is specify the serialization method, and the encoder/decoders that go with it. So, something like:

self.config = {
    'SERIALIZATION_METHOD': 'json',
    'SERIALIZATION_ENCODER': JSONEncoder,
    'SERIALIZATION_DECODER': JSONDecoder,

which would open the door to something like using yaml, or pickle.

I can add this if you like this weekend.

@xuru xuru force-pushed the custom_serialization branch from 565044a to 11e4d54 Compare January 13, 2018 22:56
@xuru xuru closed this Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants