GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-29842: Make Executor.map less eager so it handles large/unbounded… by MojoVampire · Pull Request #707 · python/cpython

bpo-29842: Make Executor.map less eager so it handles large/unbounded… #707

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.

Sign up for GitHub

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

Closed
MojoVampire wants to merge 6 commits into python:main from MojoVampire:fix-issue-29842

Uh oh!

There was an error while loading. Please reload this page.

Closed

bpo-29842: Make Executor.map less eager so it handles large/unbounded… #707

Changes from 1 commit
Commits
Show all changes
6 commits
Select commit Hold shift + click to select a range
fbdb56c
bpo-29842: Make Executor.map less eager so it handles large/unbounded…
MojoVampire Mar 18, 2017
6281379
Merge branch 'master' into fix-issue-29842
MojoVampire May 6, 2019
8394e34
Add prefetch info to docstrings
MojoVampire May 6, 2019
634a3de
Add Misc/NEWS entry
MojoVampire May 6, 2019
0152831
Remove trailing whitespace in docs
MojoVampire May 6, 2019
3c38fab
Fix behavior to follow test_free_reference requirements (generator ho…
MojoVampire May 6, 2019
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Fix behavior to follow test_free_reference requirements (generator ho…
…lds no reference to result at the moment it yields

Reduce line lengths to PEP8 limits
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@MojoVampire
MojoVampire committed May 6, 2019
commit 3c38fabdfe9d625064625b4fb84aa41d59bf250d

There are no files selected for viewing

9 changes: 5 additions & 4 deletions 9 Lib/concurrent/futures/_base.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,9 @@ def map(self, fn, *iterables, timeout=None, chunksize=1, prefetch=None):
raise ValueError("prefetch count may not be negative")

argsiter = zip(*iterables)
initialargs = itertools.islice(argsiter, self._max_workers + prefetch)

fs = collections.deque(self.submit(fn, *args) for args in itertools.islice(argsiter, self._max_workers + prefetch))
fs = collections.deque(self.submit(fn, *args) for args in initialargs)

Comment thread
MojoVampire marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

# Yield must be hidden in closure so that the futures are submitted
# before the first iterator value is required.
Expand All @@ -611,9 +612,9 @@ def result_iterator():
try:
while fs:
if timeout is None:
res = fs[0].result()
res = [fs[0].result()]
else:
res = fs[0].result(end_time - time.monotonic())
res = [fs[0].result(end_time - time.monotonic())]

# Got a result, future needn't be cancelled
del fs[0]
Expand All @@ -628,7 +629,7 @@ def result_iterator():
else:
fs.append(self.submit(fn, *args))

yield res
yield res.pop()
finally:
for future in fs:
future.cancel()
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.