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

Executor.map does not submit futures until iter.next() is called #55986

Closed
brianquinlan opened this issue Apr 6, 2011 · 7 comments
Closed

Executor.map does not submit futures until iter.next() is called #55986

brianquinlan opened this issue Apr 6, 2011 · 7 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@brianquinlan
Copy link
Contributor

BPO 11777
Nosy @brianquinlan, @merwok

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/brianquinlan'
closed_at = <Date 2011-04-07.22:33:02.566>
created_at = <Date 2011-04-06.01:16:35.236>
labels = ['type-bug', 'library']
title = 'Executor.map does not submit futures until iter.next() is called'
updated_at = <Date 2011-04-21.15:28:48.978>
user = 'https://github.com/brianquinlan'

bugs.python.org fields:

activity = <Date 2011-04-21.15:28:48.978>
actor = 'eric.araujo'
assignee = 'bquinlan'
closed = True
closed_date = <Date 2011-04-07.22:33:02.566>
closer = 'bquinlan'
components = ['Library (Lib)']
creation = <Date 2011-04-06.01:16:35.236>
creator = 'bquinlan'
dependencies = []
files = []
hgrepos = []
issue_num = 11777
keywords = []
message_count = 7.0
messages = ['133104', '133107', '133108', '133196', '133197', '133270', '134223']
nosy_count = 4.0
nosy_names = ['bquinlan', 'eric.araujo', 'ysj.ray', 'python-dev']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue11777'
versions = ['Python 3.3']

@brianquinlan
Copy link
Contributor Author

from concurrent import futures

with futures.ThreadPoolExecutor(max_workers=5) as e:
  e.map(print, range(10))

# No output

@brianquinlan brianquinlan self-assigned this Apr 6, 2011
@brianquinlan brianquinlan added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Apr 6, 2011
@ysjray
Copy link
Mannequin

ysjray mannequin commented Apr 6, 2011

Isn't this the supposed behavior?

@brianquinlan
Copy link
Contributor Author

I think that it surprising behavior, especially considering that asking for the *first* element in the iterator causes *all* of the futures to be created.

@ysjray
Copy link
Mannequin

ysjray mannequin commented Apr 7, 2011

Got it. Seems the behavior is not consist with the Executor.map() function:

"The returned iterator raises a TimeoutError if __next__() is called and the result isn't available after timeout seconds from ***the original call to map()***"

@brianquinlan
Copy link
Contributor Author

Nice catch. I hadn't noticed that the docs are lying :-)

@python-dev
Copy link
Mannequin

python-dev mannequin commented Apr 7, 2011

New changeset 126353bc7e94 by Brian Quinlan in branch 'default':
Issue bpo-11777: Executor.map does not submit futures until iter.next() is called
http://hg.python.org/cpython/rev/126353bc7e94

@merwok
Copy link
Member

merwok commented Apr 21, 2011

Just a bystander remark: when you use present in the commit message and Misc/NEWS entry (like in “Executor.map does not submit futures until iter.next() is called”), I don’t know whether it is the behavior being fixed (“X used to do Y”) or the new, correct behavior (“X now does Z”).

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants