Skip to content

Conversation

@wilywampa
Copy link
Contributor

This change is a result of investigating this StackOverflow question regarding parallel.Reference objects in a list of dictionaries: http://stackoverflow.com/questions/31343529/ipython-parallel-reference-with-map-vs-apply

from IPython import parallel
from IPython.parallel import Client
from IPython.parallel import Reference

rc = Client()
dview = rc.direct_view()
dview.block = True

dview['l'] = [0, 1]
kws = [{'l': Reference('l')}]
def second(kws):
    l = kws['l']
    return l[1]

dview.map(second, kws) # results in TypeError: 'Reference' object does not support indexing

When a list of dictionaries is provided as an argument to a parallel map, the Reference objects in the dicts aren't reached by the uncan function. Adding dict to the list of uncanners produces the correct behavior:

>>> dview.map(second, kws)
[1]

minrk added a commit that referenced this pull request Sep 8, 2015
Add uncan_dict to uncan_map
@minrk minrk merged commit d3f7002 into ipython:master Sep 8, 2015
@minrk minrk added this to the 4.1 milestone Sep 8, 2015
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.

2 participants