homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: multiprocessing.Condition.wait_for missing
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: neologix, pitrou, python-dev, sbt
Priority: normal Keywords: patch

Created on 2012年02月22日 15:01 by sbt, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
cond_wait_for.patch sbt, 2012年02月23日 13:41
cond_wait_for.patch sbt, 2012年02月24日 13:26
cond_wait_for.patch sbt, 2012年04月07日 22:36 review
cond_wait_for.patch sbt, 2012年04月16日 14:42 review
Messages (11)
msg153956 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012年02月22日 15:01
multiprocessing.Condition is missing a counterpart for the wait_for() method added to threading.Condition in Python 3.2.
I will work on a patch.
msg154063 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012年02月23日 13:41
Patch which just copies the implementation from threading.
msg154093 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2012年02月23日 22:06
In test/test_multiprocessing.py:
"""
 def test_waitfor(self):
 [...]
 with cond:
 result = cond.wait_for(lambda : state.value==0)
 self.assertTrue(result)
 self.assertEqual(state.value, 0)
 for i in range(4):
 time.sleep(0.01)
 with cond:
 state.value += 1
 cond.notify()
"""
Shouldn't the `for` loop be outside the outer `with` block?
In Lib/multiprocessing/managers.py:
Is there a good reason why the wait_for() proxy method can't simply be implemented as:
return self._callmethod('wait_for', (predicate, timeout))?
(There may be, I just didn't check).
Finally, the documentation should be updated (Doc/library/multiprocessing.rst).
Otherwise, it would probably be better if you could submit a contributor agreement (and also maybe update your name on the tracker), unless that's a problem for you?
msg154135 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012年02月24日 13:26
> Shouldn't the `for` loop be outside the outer `with` block?
Yes.
> In Lib/multiprocessing/managers.py:
> Is there a good reason why the wait_for() proxy method can't simply be
> implemented as:
> return self._callmethod('wait_for', (predicate, timeout))?
> 
> (There may be, I just didn't check).
That would only work if predicate is picklable, which is unlikely to be the case. (The lambda functions used in the unit tests are not picklable.)
> Finally, the documentation should be updated 
> (Doc/library/multiprocessing.rst).
Fixed in new patch.
> Otherwise, it would probably be better if you could submit a contributor 
> agreement (and also maybe update your name on the tracker), unless that's
> a problem for you?
I will try to submit it over the weekend.
msg157244 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012年03月31日 23:54
AFAICT (Raw)Value relies on ctypes, so the tests should be skipped if ctypes is unavailable. Or I guess you could use a Semaphore instead.
msg157762 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012年04月07日 22:36
New patch skips tests if ctypes not available.
msg158459 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012年04月16日 14:42
New patch which calculates endtime outside loop.
msg158497 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012年04月16日 20:16
Charles-François, will you take this one? :)
msg158533 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2012年04月17日 07:32
> Charles-François, will you take this one? :)
Yes :-)
msg158557 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年04月17日 16:46
New changeset 5606ee052783 by Charles-François Natali in branch 'default':
Issue #14087: multiprocessing: add Condition.wait_for(). Patch by sbt.
http://hg.python.org/cpython/rev/5606ee052783 
msg158559 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2012年04月17日 17:30
Committed.
Thanks for the patch, and sorry for the delay!
History
Date User Action Args
2022年04月11日 14:57:27adminsetgithub: 58295
2012年04月17日 17:30:15neologixsetstatus: open -> closed
resolution: fixed
messages: + msg158559

stage: commit review -> resolved
2012年04月17日 16:46:49python-devsetnosy: + python-dev
messages: + msg158557
2012年04月17日 07:32:52neologixsetmessages: + msg158533
2012年04月16日 20:16:30pitrousetmessages: + msg158497
2012年04月16日 14:42:52sbtsetfiles: + cond_wait_for.patch

messages: + msg158459
2012年04月07日 22:36:42sbtsetfiles: + cond_wait_for.patch

messages: + msg157762
2012年03月31日 23:54:06pitrousetmessages: + msg157244
2012年03月31日 23:42:54pitroulinkissue14059 dependencies
2012年03月26日 14:53:33neologixsetnosy: + pitrou

stage: commit review
2012年02月24日 13:26:56sbtsetfiles: + cond_wait_for.patch

messages: + msg154135
2012年02月23日 22:06:20neologixsetnosy: + neologix
messages: + msg154093
2012年02月23日 13:41:23sbtsetfiles: + cond_wait_for.patch
keywords: + patch
messages: + msg154063
2012年02月22日 15:01:24sbtcreate

AltStyle によって変換されたページ (->オリジナル) /