Title: multiprocessing docs bury very important 'callback=' args
Type: enhancement Stage: patch review
Components: Documentation Versions: Python 3.8, Python 3.7, Python 3.6, Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Mariatta, chadmiller-amzn, davin, docs@python, ned.deily, pitrou
Priority: normal Keywords: patch

Created on 2018-03-15 18:50 by chadmiller-amzn, last changed 2018-06-08 19:47 by ned.deily.

Pull Requests
URL Status Linked Edit
PR 6122 open chadmiller-amzn, 2018-03-15 21:10
PR 6455 open chadmiller-amzn, 2018-04-12 01:05
Messages (6)
msg313905 - (view) Author: Chad (chadmiller-amzn) * Date: 2018-03-15 18:50
Callbacks are really important in multiprocessing. Doc writer almost ignores them.
msg313906 - (view) Author: Chad (chadmiller-amzn) * Date: 2018-03-15 18:55

(Putting that in "GitHub PR" field says "Edit Error: Unknown PR format, acceptable formats are: full github URL, #pr_number, pr_number")
msg313915 - (view) Author: Mariatta Wijaya (Mariatta) * (Python committer) Date: 2018-03-15 20:46
Can you make your PR in python/cpython GitHub repo, instead of your own fork?
msg314162 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2018-03-20 19:45
I don't really agree that "callbacks are really important in multiprocessing" (I think I've hardly ever used them).  I agree with the other doc changes in the PR.
msg314267 - (view) Author: Chad (chadmiller-amzn) * Date: 2018-03-22 15:52
On topic: My CLA is signed as of Monday, 19 March. My status here is not updated yet.

pitrou, off-topic: Without callbacks, users who want multiprocessing functions to return something, not just mutate state somewhere else, must gather jobs in a list and continually iterate through them polling to see if each has finished yet and conditionally popping it from the list. It's expensive and ugly and error-prone. Callbacks are really great, you should try them again.

So much better:

pool.apply_async(func, args, callback=when_finished_call_with_result)
msg319100 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-06-08 19:47
These doc changes have been languishing.  We have a difference of opinion about adding a callback example.  I don't have a strong feeling one way or the other.  Davin or anyone else, what say you?
Date User Action Args
2018-06-08 19:47:47ned.deilysetnosy: + ned.deily
messages: + msg319100
2018-04-12 01:05:48chadmiller-amznsetpull_requests: + pull_request6150
2018-03-22 15:52:55chadmiller-amznsetmessages: + msg314267
2018-03-20 19:45:29pitrousetmessages: + msg314162
2018-03-15 21:10:27chadmiller-amznsetkeywords: + patch
stage: patch review
pull_requests: + pull_request5886
2018-03-15 20:46:42Mariattasetversions: - Python 3.4, Python 3.5
2018-03-15 20:46:10Mariattasetnosy: + Mariatta
messages: + msg313915
2018-03-15 18:55:08chadmiller-amznsetmessages: + msg313906
versions: + Python 3.4, Python 3.5
2018-03-15 18:51:31ned.deilysetnosy: + pitrou, davin

versions: - Python 3.4, Python 3.5
2018-03-15 18:50:50chadmiller-amzncreate