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 uncan_dict to uncan_map #53

Merged
merged 1 commit into from
Sep 8, 2015
Merged

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.

None yet

2 participants