-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to module-based singleton for ParslSerializer (#2467)
This fixes some problems where the class based serializer object was sometimes serialized and sent over the network; there is no reasonable behaviour for deserializing a singleton, but in the previous implementation, the caches used for serialization were overwritten. The ParslSerializer class is removed entirely and the parsl.serialize.facade is the singleton instead. This is a more pythonic way of representing singletons. Use `git show -w` on this commit to see that most of the usual diff is only whitespace indentation changes. To identify places where a ParslSerializer object was deserialized, I added a __setstate__ method which is called whenever a ParslSerializer is deserialized. This fired when using monitoring, as monitoring carries round with it quite a lot of serialization overhead. @@ -171,3 +171,6 @@ class ParslSerializer(object): assert len(unpacked) == 3, "Unpack expects 3 buffers, got {}".format(len(unpacked)) return unpacked + + def __setstate__(self, state): + raise ValueError("BENC: serializer setstate called")
- Loading branch information
1 parent
dbffcce
commit 56491bc
Showing
3 changed files
with
162 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,6 @@ | ||
from parsl.serialize.facade import ParslSerializer | ||
parsl_serializer = ParslSerializer() | ||
serialize = parsl_serializer.serialize | ||
deserialize = parsl_serializer.deserialize | ||
pack_apply_message = parsl_serializer.pack_apply_message | ||
unpack_apply_message = parsl_serializer.unpack_apply_message | ||
from parsl.serialize.facade import serialize, deserialize, pack_apply_message, unpack_apply_message | ||
|
||
__all__ = ['ParslSerializer', | ||
'serialize', | ||
__all__ = ['serialize', | ||
'deserialize', | ||
'pack_apply_message', | ||
'unpack_apply_message'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters