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

add pickleutil.use_dill #4552

Merged
merged 5 commits into from
Nov 28, 2013
Merged

add pickleutil.use_dill #4552

merged 5 commits into from
Nov 28, 2013

Conversation

minrk
Copy link
Member

@minrk minrk commented Nov 17, 2013

and DirectView.use_dill to call it locally and on all engines

example notebook added. I tried to include tests, but something about the test environment causes problems with dill.

closes #4551

@mrocklin
Copy link

I've also had issues with dill and testing. See uqfoundation/dill#16

@Carreau
Copy link
Member

Carreau commented Nov 18, 2013

I thought cPickle was the default on Py3, does this work than ?

@takluyver
Copy link
Member

To expand: import pickle on Python 3 will try to load the C pickle implementation, and fall back to the Python implementation if that fails for some reason.

Possibly we should be setting dill itself as the pickle implementation? @mmckerns, any tips?

@mmckerns
Copy link
Contributor

To take advantage of dill, mpi4py abstracts the pickle import, so you can do this:

>>> from mpi4py import MPI
>>> MPI._p_pickle.dumps = dill.dumps
>>> MPI._p_pickle.loads = dill.loads

It requires the user to import dill on their own first.

So you might be able to make a singleton somewhere with the module or with the dumps/loads functions.

@minrk
Copy link
Member Author

minrk commented Nov 18, 2013

This singleton does already exist (well, in two places, so 'doubleton'?). I just need to change the mod.pickle = pickle to mod.pickle = dill

set mod.pickle = dill
@minrk
Copy link
Member Author

minrk commented Nov 27, 2013

Will merge soon unless anyone wants to do further review.

@mrocklin
Copy link

One could generalize this away from dill by instead making a serialize_with(...) method that took a serialization library, e.g.

import dill
view.serialize_with(dill)

But, given the small nature of this fix and the small number of fully functional serializers out there, this may be overly farsighted.

@Carreau
Copy link
Member

Carreau commented Nov 28, 2013

+1

minrk added a commit that referenced this pull request Nov 28, 2013
@minrk minrk merged commit 818f778 into ipython:master Nov 28, 2013
@minrk minrk deleted the use_dill branch November 28, 2013 19:09
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
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.

Serialize methods and closures
5 participants