Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user pluggable serializers and add a demonstration ProxyStore serializer #2842

Merged
merged 22 commits into from
Jul 27, 2023

Conversation

benclifford
Copy link
Collaborator

This PR rearranges the deserializer identifier handling so as to dynamically load unknown serializers. These should be identified by a module and class name (and that identifier will be generated automatically).

New serializers, implementing SerializerBase, can be implemented and registered for either the code or data paths in serialization using the existing register_method_for_* functions introduced in #2831

This PR also introduces an example serializer using this API: it extends dill to use ProxyStore on certain objects determined by a user specified policy.

The API for reconfiguring serializers is rather awkward, as evidenced by one of the ProxyStore test case, but this PR does not attempt to make this any nicer.

Type of change

  • New feature (non-breaking change that adds functionality)

parsl/serialize/base.py Outdated Show resolved Hide resolved
Comment on lines +29 to +31
m = bytes(t.__module__, encoding="utf-8")
c = bytes(t.__name__, encoding="utf-8")
return m + b' ' + c
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be double-check, __name__ and not __qualname__ is intended?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the cases where __qualname__ and __name__ differ, this is often going to break: the module + name needs to be something importable.

One case that could work, a class defined directly inside another class without any enclosing function/closure, I would have to poke at the import side of things to see how that would work.

…roxystore test, as it cannot be imported when optional proxystore is not installed
@benclifford benclifford marked this pull request as ready for review July 26, 2023 19:24
@benclifford benclifford merged commit 11a0ded into master Jul 27, 2023
4 checks passed
@benclifford benclifford deleted the benc-serializer-pluggable-identifier branch July 27, 2023 10:08
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