-
Notifications
You must be signed in to change notification settings - Fork 98
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
Serialization of unpickable object on multiprocessing (e.g. cloudpickle) #53
Comments
Also, pickling around builtin objects causes a strange error (when assert fails inside a subprocess): Traceback (most recent call last):
File ".../lib/python3.7/multiprocessing/queues.py", line 236, in _feed
obj = _ForkingPickler.dumps(obj)
File ".../lib/python3.7/multiprocessing/reduction.py", line 51, in dumps
cls(buf, protocol).dump(obj)
_pickle.PicklingError: Can't pickle <class 'AssertionError'>: it's not the same object as builtins.AssertionError |
Hey @wookayin, For your example, for multiprocessing stuff just avoid using lambdas by defining proper python funtions in replacement.
What do you think? |
This issue will be hard to fix, I already have error checking code but import time
from multiprocessing import Queue
data = [lambda i: i] * 10
queue = Queue()
for x in data:
queue.put(x)
time.sleep(0.1) Therefore the code assumes that elements are effectively added when they are not and the execution ends normally with an empty list. |
Hi, are the test out of date? These tests seem to use lambdas,
They fail locally, but I see them pass previously on the CI. Could it be a platform specific pickling issue? I might be missing something. |
One inherent hassle of python multiprocessing is pickling. Currently, pypeln does not consider this case, hence an error:
(1) Why does it return a valid list? It should throw an Error rather than returning a "wrong" output.
(2) Can you add cloudpickle support to handle with non-pickleable objects?
For example,
joblib
supports cloudpickle: https://joblib.readthedocs.io/en/latest/auto_examples/serialization_and_wrappers.htmlThe text was updated successfully, but these errors were encountered: