[Python-checkins] r86374 - python/branches/py3k/Doc/library/multiprocessing.rst

ask.solem python-checkins at python.org
Tue Nov 9 22:36:57 CET 2010


Author: ask.solem
Date: Tue Nov 9 22:36:56 2010
New Revision: 86374
Log:
Documented the new error_callback keyword argument to multiprocessing.Pool's apply_async and map_async
Modified:
 python/branches/py3k/Doc/library/multiprocessing.rst
Modified: python/branches/py3k/Doc/library/multiprocessing.rst
==============================================================================
--- python/branches/py3k/Doc/library/multiprocessing.rst	(original)
+++ python/branches/py3k/Doc/library/multiprocessing.rst	Tue Nov 9 22:36:56 2010
@@ -1582,14 +1582,21 @@
 suited for performing work in parallel. Additionally, the passed in
 function is only executed in one of the workers of the pool.
 
- .. method:: apply_async(func[, args[, kwds[, callback]]])
+ .. method:: apply_async(func[, args[, kwds[, callback[, error_callback]]]])
 
 A variant of the :meth:`apply` method which returns a result object.
 
 If *callback* is specified then it should be a callable which accepts a
 single argument. When the result becomes ready *callback* is applied to
- it (unless the call failed). *callback* should complete immediately since
- otherwise the thread which handles the results will get blocked.
+ it, that is unless the call failed, in which case the *error_callback*
+ is applied instead
+
+ If *error_callback* is specified then it should be a callable which
+ accepts a single argument. If the target function fails, then
+ the *error_callback* is called with the exception instance.
+
+ Callbacks should complete immediately since otherwise the thread which
+ handles the results will get blocked.
 
 .. method:: map(func, iterable[, chunksize])
 
@@ -1606,8 +1613,15 @@
 
 If *callback* is specified then it should be a callable which accepts a
 single argument. When the result becomes ready *callback* is applied to
- it (unless the call failed). *callback* should complete immediately since
- otherwise the thread which handles the results will get blocked.
+ it, that is unless the call failed, in which case the *error_callback*
+ is applied instead
+
+ If *error_callback* is specified then it should be a callable which
+ accepts a single argument. If the target function fails, then
+ the *error_callback* is called with the exception instance.
+
+ Callbacks should complete immediately since otherwise the thread which
+ handles the results will get blocked.
 
 .. method:: imap(func, iterable[, chunksize])
 


More information about the Python-checkins mailing list

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