I came across this issue while using ipyparallel. When I try to use cloudpickle, it appears I cannot push or pull globals anymore. Does anybody know the reason or a way around this? In general, I want to be able to send a wrapper around a function (which I cannot do with pickle), but also to set globals on the engines. Here an example of a session (this is on my mac, but it is reproducible on my linux workstation as well, with python 2.7).
form iPython 3.5.3 |Anaconda custom (x86_64)| (default, Mar 6 2017, 12:15:08)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.0.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from ipyparallel import Client
In [2]: rcl = Client()
In [3]: dv = rcl [:]
In [4]: dv['x'] = 3
In [5]: dv['x']
Out[5]: [3, 3]
In [6]: dv.use_cloudpickle()
Out[6]: <AsyncResult: use_cloudpickle>
In [7]: dv['x']
[0:apply]:
---------------------------------------------------------------------------NameError Traceback (most recent call last)<string> in <module>()
/Users/gaffa/anaconda/lib/python3.5/site-packages/ipyparallel/util.py in _pull(keys)
270 return [eval(key, globals()) for key in keys]
271 else:
--> 272 return eval(keys, globals())
273
274 @interactive
<string> in <module>()
NameError: name 'x' is not defined
[1:apply]:
---------------------------------------------------------------------------NameError Traceback (most recent call last)<string> in <module>()
/Users/gaffa/anaconda/lib/python3.5/site-packages/ipyparallel/util.py in _pull(keys)
270 return [eval(key, globals()) for key in keys]
271 else:
--> 272 return eval(keys, globals())
273
274 @interactive
<string> in <module>()
NameError: name 'x' is not defined