Skip to content

Commit

Permalink
[REF-2089] Use dill instead of cloudpickle for serialization (#2922)
Browse files Browse the repository at this point in the history
* Use dill instead of cloudpickle for serialization

* smaller size pickles
* support dynamically defined states
* avoid issues with unpickleable globals

* pyproject: add dill, remove cloudpickle

* poetry.lock: relock dependencies

* Dynamically convert EventHandler to functools.partial

Instead of converting the functions up front and assigning them to the
instance, unbox the function from the EventHandler when it is requested via
__getattribute__. This reduces the size of the per-instance pickle, because
event handler bodies do not need to be included.

* Improve checking for cython_function_or_method

Because pydantic can be installed without cython, only use the workaround in
the case where the BaseModel.validate function is NOT a FunctionType,
indicating it's a cython function.

* Serialize all State subclasses by reference
  • Loading branch information
masenf committed Mar 27, 2024
1 parent b34c97d commit b788890
Show file tree
Hide file tree
Showing 5 changed files with 305 additions and 288 deletions.
Loading

0 comments on commit b788890

Please sign in to comment.