diff options
author | Ask Solem <askh@opera.com> | 2010-11-09 21:36:56 (GMT) |
---|---|---|
committer | Ask Solem <askh@opera.com> | 2010-11-09 21:36:56 (GMT) |
commit | 1d3b89397b02bde3d6e8f63619a28d11fd13ac4d (patch) | |
tree | 012e902f426bada277f34a13a5d17a5c8a91b494 | |
parent | 9bc35682de4911ea917f1016cc5fd67d3d1be97e (diff) | |
download | cpython-1d3b89397b02bde3d6e8f63619a28d11fd13ac4d.zip cpython-1d3b89397b02bde3d6e8f63619a28d11fd13ac4d.tar.gz cpython-1d3b89397b02bde3d6e8f63619a28d11fd13ac4d.tar.bz2 |
Documented the new error_callback keyword argument to multiprocessing.Pool's apply_async and map_async
-rw-r--r-- | Doc/library/multiprocessing.rst | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index 3908bcb..4f3f1cd 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -1582,14 +1582,21 @@ with the :class:`Pool` class. 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 @@ with the :class:`Pool` class. 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]) |