Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2293)

Issue 61210043: Fix for http://bugs.python.org/issue20566 (Tulip issue 127) (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 2 months ago by GvR
Modified:
10 years, 2 months ago
Reviewers:
glangford
Visibility:
Public.

Description

Fix for http://bugs.python.org/issue20566 (Tulip issue 127)

Patch Set 1 : Initial proof of concept #

Patch Set 2 : Fix test_as_completed_reverse_wait (by changing the desired behavior!) #

Patch Set 3 : Add timeout support #

Patch Set 4 : Cancel timeout when last future completes. Various cleanups, more comments. #

Total comments: 6

Patch Set 5 : Part of the new refactoring. XXX marks unresolved issues. #

Patch Set 6 : Add comment explaining the idea. (WIP) #

Patch Set 7 : Completed narrative, and added some finishing touches. #

Total comments: 14

Patch Set 8 : Started from scratch using a Queue. Passes all tests! #

Total comments: 6

Patch Set 9 : Add a few clarifying comments. Rename internal functions with leading underscore. #

Patch Set 10 : Add comment to peculiar import. #

Total comments: 1

Patch Set 11 : Update docstring. Add another test to increase coverage. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+55 lines, -21 lines) Patch
M asyncio/tasks.py View 1 2 3 4 5 6 7 8 9 10 3 chunks +33 lines, -20 lines 0 comments Download
M tests/test_tasks.py View 1 2 3 4 5 6 7 8 9 10 3 chunks +22 lines, -1 line 0 comments Download

Messages

Total messages: 36
GvR
NOTE: Need more test coverage, esp. for the two "optimization" blocks and for these two ...
10 years, 2 months ago (2014-02-09 05:12:13 UTC) #1
glangford
https://codereview.appspot.com/61210043/diff/60001/asyncio/tasks.py File asyncio/tasks.py (right): https://codereview.appspot.com/61210043/diff/60001/asyncio/tasks.py#newcode513 asyncio/tasks.py:513: if completed >= len(results) and timeout_handle is not None: ...
10 years, 2 months ago (2014-02-09 14:55:05 UTC) #2
GvR
https://codereview.appspot.com/61210043/diff/60001/asyncio/tasks.py File asyncio/tasks.py (right): https://codereview.appspot.com/61210043/diff/60001/asyncio/tasks.py#newcode513 asyncio/tasks.py:513: if completed >= len(results) and timeout_handle is not None: ...
10 years, 2 months ago (2014-02-09 17:51:58 UTC) #3
glangford
https://codereview.appspot.com/61210043/diff/60001/asyncio/tasks.py File asyncio/tasks.py (right): https://codereview.appspot.com/61210043/diff/60001/asyncio/tasks.py#newcode511 asyncio/tasks.py:511: resf._copy_state(f) Seems a shame to have to use a ...
10 years, 2 months ago (2014-02-09 18:14:30 UTC) #4
GvR
https://codereview.appspot.com/61210043/diff/60001/asyncio/tasks.py File asyncio/tasks.py (right): https://codereview.appspot.com/61210043/diff/60001/asyncio/tasks.py#newcode511 asyncio/tasks.py:511: resf._copy_state(f) On 2014/02/09 18:14:30, glangford wrote: > Seems a ...
10 years, 2 months ago (2014-02-09 18:44:41 UTC) #5
glangford
https://codereview.appspot.com/61210043/diff/60001/asyncio/tasks.py File asyncio/tasks.py (right): https://codereview.appspot.com/61210043/diff/60001/asyncio/tasks.py#newcode511 asyncio/tasks.py:511: resf._copy_state(f) On 2014/02/09 18:44:41, GvR wrote: > On 2014/02/09 ...
10 years, 2 months ago (2014-02-09 19:13:21 UTC) #6
glangford
On 2014/02/09 19:13:21, glangford wrote: > https://codereview.appspot.com/61210043/diff/60001/asyncio/tasks.py > File asyncio/tasks.py (right): > > https://codereview.appspot.com/61210043/diff/60001/asyncio/tasks.py#newcode511 > ...
10 years, 2 months ago (2014-02-09 19:56:16 UTC) #7
GvR
Well, Queue uses Futures internally... But wait, I have another refactoring in mind. On Feb ...
10 years, 2 months ago (2014-02-09 20:19:09 UTC) #8
GvR
Glenn, I did the promised refactoring and added a huge narrative (perhaps excessive :-). I'd ...
10 years, 2 months ago (2014-02-10 04:49:29 UTC) #9
GvR
https://codereview.appspot.com/61210043/diff/120001/asyncio/tasks.py File asyncio/tasks.py (right): https://codereview.appspot.com/61210043/diff/120001/asyncio/tasks.py#newcode361 asyncio/tasks.py:361: assert not isinstance(fs, futures.Future) and not iscoroutine(fs) Oops, this ...
10 years, 2 months ago (2014-02-10 04:52:29 UTC) #10
glangford
https://codereview.appspot.com/61210043/diff/120001/asyncio/tasks.py File asyncio/tasks.py (right): https://codereview.appspot.com/61210043/diff/120001/asyncio/tasks.py#newcode530 asyncio/tasks.py:530: # yielded already). Because we always pop an output ...
10 years, 2 months ago (2014-02-10 13:28:21 UTC) #11
glangford
https://codereview.appspot.com/61210043/diff/120001/asyncio/tasks.py File asyncio/tasks.py (right): https://codereview.appspot.com/61210043/diff/120001/asyncio/tasks.py#newcode613 asyncio/tasks.py:613: todo.clear() Why clear todo within the callback? Is this ...
10 years, 2 months ago (2014-02-10 15:54:43 UTC) #12
glangford
https://codereview.appspot.com/61210043/diff/120001/asyncio/tasks.py File asyncio/tasks.py (right): https://codereview.appspot.com/61210043/diff/120001/asyncio/tasks.py#newcode620 asyncio/tasks.py:620: f.add_done_callback(on_completion) <...some time later...> The "callback cleanup" effort required ...
10 years, 2 months ago (2014-02-10 17:46:08 UTC) #13
GvR
You're asking lots of good questions. I will have answers, but I need to focus ...
10 years, 2 months ago (2014-02-10 18:04:18 UTC) #14
glangford
No worries, I am just looking at it in pieces as I find time during ...
10 years, 2 months ago (2014-02-10 21:50:46 UTC) #15
glangford
Ok, that's all for now from me - I will jump back in when I ...
10 years, 2 months ago (2014-02-10 22:13:56 UTC) #16
GvR
Let me just say that if randomized tests are necessary to give us confidence in ...
10 years, 2 months ago (2014-02-10 22:27:45 UTC) #17
glangford
On 2014/02/10 22:27:45, GvR wrote: > Let me just say that if randomized tests are ...
10 years, 2 months ago (2014-02-10 23:42:11 UTC) #18
GvR
Your Queue idea is cool! Have a look at this code: def as_completed(fs, *, loop=None, ...
10 years, 2 months ago (2014-02-11 04:26:33 UTC) #19
GvR
10 years, 2 months ago (2014-02-11 16:16:06 UTC) #20
GvR
Adding some annotations in the comments. https://codereview.appspot.com/61210043/diff/140001/asyncio/tasks.py File asyncio/tasks.py (right): https://codereview.appspot.com/61210043/diff/140001/asyncio/tasks.py#newcode464 asyncio/tasks.py:464: """Return an iterator ...
10 years, 2 months ago (2014-02-11 17:21:40 UTC) #21
glangford
Nice. https://codereview.appspot.com/61210043/diff/140001/asyncio/tasks.py File asyncio/tasks.py (right): https://codereview.appspot.com/61210043/diff/140001/asyncio/tasks.py#newcode480 asyncio/tasks.py:480: from .queues import Queue On 2014/02/11 17:21:40, GvR ...
10 years, 2 months ago (2014-02-11 19:54:59 UTC) #22
GvR
Add a few clarifying comments. Rename internal functions with leading underscore.
10 years, 2 months ago (2014-02-11 20:05:02 UTC) #23
GvR
Add comment to peculiar import.
10 years, 2 months ago (2014-02-11 20:05:51 UTC) #24
glangford
These tests all pass. Without the patch to use a Queue, pass 3 fails. https://codereview.appspot.com/61210043/diff/180001/tests/test_tasks.py ...
10 years, 2 months ago (2014-02-11 20:39:57 UTC) #25
GvR
Nice fuzz test. Perhaps you can contribute it to the examples directory? We don't really ...
10 years, 2 months ago (2014-02-11 21:27:15 UTC) #26
GvR
Oh, and is there anything else you think I should do before committing this code? ...
10 years, 2 months ago (2014-02-11 21:27:52 UTC) #27
glangford
On 2014/02/11 21:27:15, GvR wrote: > Nice fuzz test. Perhaps you can contribute it to ...
10 years, 2 months ago (2014-02-11 22:08:57 UTC) #28
glangford
On 2014/02/11 21:27:52, GvR wrote: > Oh, and is there anything else you think I ...
10 years, 2 months ago (2014-02-11 22:33:50 UTC) #29
GvR
Update docstring. Add another test to increase coverage.
10 years, 2 months ago (2014-02-12 04:28:48 UTC) #30
GvR
New version (just docstring updates and a new test). I'll push this tomorrow if nobody ...
10 years, 2 months ago (2014-02-12 04:30:12 UTC) #31
glangford
On 2014/02/12 04:30:12, GvR wrote: > New version (just docstring updates and a new test). ...
10 years, 2 months ago (2014-02-12 13:10:32 UTC) #32
GvR
Pushed. I also committed your fuzz test to the examples directory. Thanks so much for ...
10 years, 2 months ago (2014-02-13 02:03:39 UTC) #33
glangford
On 2014/02/13 02:03:39, GvR wrote: > Pushed. I also committed your fuzz test to the ...
10 years, 2 months ago (2014-02-13 03:11:16 UTC) #34
GvR
On 2014/02/13 03:11:16, glangford wrote: > On 2014/02/13 02:03:39, GvR wrote: > > Pushed. I ...
10 years, 2 months ago (2014-02-13 03:17:40 UTC) #35
glangford
10 years, 2 months ago (2014-02-13 12:46:25 UTC) #36
Message was sent while issue was closed.
On 2014/02/13 03:17:40, GvR wrote:
> On 2014/02/13 03:11:16, glangford wrote:
> > On 2014/02/13 02:03:39, GvR wrote:
> > > Pushed. I also committed your fuzz test to the examples directory. Thanks
so
> > > much for reporting this issue and guiding my towards the right fix!
> > 
> > Great news. Happy to help!
> 
> BTW did you say you had a fuzz test for wait() as well?

I did say that...but as I am reviewing it more carefully now, I realize that it
doesn't test what I thought it did. Because wait returns done and pending
*sets*, the test driver doesn't have visibility into the return order. So the
wait test is not in shape for the examples directory.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b