[issue16307] multiprocess.pool.map_async callables not working

2012-10-26 Thread Janne Karila

Janne Karila added the comment:

Otherwise I agree, but what if one of the callbacks is not called? The test 
case would fail on assertEqual(2, len(call_args)) but you wouldn't know which 
callback is the problem.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16307
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16307] multiprocess.pool.map_async callables not working

2012-10-26 Thread Janne Karila

Janne Karila added the comment:

The length assertion protects the test from breaking with IndexError. How about 
this? Though, it looks like two test cases to me.

+self.pool.map_async(int, ['1'],
+callback=call_args.append,
+error_callback=call_args.append).wait()
+self.assertEqual(1, len(call_args))
+self.assertEqual([1], call_args[0])
+self.pool.map_async(int, ['a'],
+callback=call_args.append,
+error_callback=call_args.append).wait()
+self.assertEqual(2, len(call_args))
+self.assertIsInstance(call_args[1], ValueError)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16307
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16307] multiprocess.pool.map_async callables not working

2012-10-25 Thread Janne Karila

Janne Karila added the comment:

I'm working on the test. It keeps failing...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16307
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16307] multiprocess.pool.map_async callables not working

2012-10-25 Thread Janne Karila

Janne Karila added the comment:

Three test cases added. 

The tricky part in writing the tests was to realize that when the tests are run 
with Manager, the callback goes through a proxy object.

--
Added file: http://bugs.python.org/file27711/test_callback.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16307
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16307] multiprocess.pool.map_async callables not working

2012-10-24 Thread Janne Karila

Janne Karila added the comment:

Indeed, the current implementation map_async simply ignores the callback 
arguments:

def map_async(self, func, iterable, chunksize=None, callback=None,
error_callback=None):
'''
Asynchronous version of `map()` method.
'''
return self._map_async(func, iterable, mapstar, chunksize)

--
nosy: +Janne.Karila

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16307
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16307] multiprocess.pool.map_async callables not working

2012-10-24 Thread Janne Karila

Janne Karila added the comment:

Here's a patch that adds the missing arguments to the call to _map_async.
The bug seems to originate from enhancement #12708 that added starmap_async to 
3.3.

--
keywords: +patch
Added file: http://bugs.python.org/file27690/callback.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16307
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com