Skip to content

bpo-17140: Document multiprocessing's ThreadPool#23812

Merged
pablogsal merged 1 commit into
python:masterfrom
godlygeek:document_threadpool
Dec 18, 2020
Merged

bpo-17140: Document multiprocessing's ThreadPool#23812
pablogsal merged 1 commit into
python:masterfrom
godlygeek:document_threadpool

Conversation

@godlygeek

@godlygeek godlygeek commented Dec 17, 2020

Copy link
Copy Markdown
Contributor

Up until now the multiprocessing.pool.ThreadPool class has gone
undocumented, despite being a public class in multiprocessing that is
included in multiprocessing.pool.__all__.

https://bugs.python.org/issue17140

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. The only comment I have is that it seems strange to place ThreadPool under the Process Pools section, though I understand that it makes sense since it's a subclass of Pool. Maybe we can create a Thread Pools subsection for it. What do you think?

@godlygeek

godlygeek commented Dec 17, 2020

Copy link
Copy Markdown
Contributor Author

I almost did that, and don't mind changing it to be that way if you prefer. Would you like the new section directly below the "Process Pools" section?

I also considered putting it in the "The :mod:multiprocessing.dummy module" section, which is slightly weird since it's in multiprocessing.pool, but also is arguably the place where it best belongs since it is related to the "multiprocessing but with threads instead of processes" thing that multiprocessing.dummy does, and because multiprocessing.dummy.Pool does return ThreadPool instances (though it is a wrapper function around multiprocessing.Pool.ThreadPool for some reason, not an alias for it).

@Fidget-Spinner

Copy link
Copy Markdown
Member

I almost did that, and don't mind changing it to be that way if you prefer. Would you like the new section directly below the "Process Pools" section?

Hmm I think, I'll wait and see what the core dev who reviews this prefers. Thanks for working on this :).

@pablogsal pablogsal requested a review from pitrou December 17, 2020 16:19
Comment thread Doc/library/multiprocessing.rst Outdated
@pablogsal pablogsal self-assigned this Dec 17, 2020
@godlygeek

Copy link
Copy Markdown
Contributor Author

@pablogsal OK, I've force-pushed a new commit that yanks it down into the multiprocessing.dummy section, and explains that ThreadPoolExecutor is generally preferable. Take a look and let me know if you think there's anything else it needs, please.

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I will leave some days in case Antoine has time to review this before landing in case he has some new insights or he wants some changes.

@godlygeek

Copy link
Copy Markdown
Contributor Author

I just made one final change - I had the note about preferring ThreadPoolExecutor above the class definition, and I've moved it down into the documentation for the class instead.

Up until now the `multiprocessing.pool.ThreadPool` class has gone
undocumented, despite being a public class in multiprocessing that is
included in `multiprocessing.pool.__all__`.
@godlygeek

Copy link
Copy Markdown
Contributor Author

One more force push - I noticed a missing word after re-reading this.

@pablogsal

Copy link
Copy Markdown
Member

One more force push - I noticed a missing word after re-reading this.

Note the there is no need for force pushes: the commits will be squashed and the core Dev merging will write the final commit anyway.

@pitrou

pitrou commented Dec 17, 2020

Copy link
Copy Markdown
Member

This is fine with me. Thanks for reviewing @pablogsal !

@pablogsal pablogsal merged commit 84ebcf2 into python:master Dec 18, 2020
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @godlygeek for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8, 3.9.
🐍🍒⛏🤖

@bedevere-bot

Copy link
Copy Markdown

GH-23834 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 18, 2020
Up until now, the `multiprocessing.pool.ThreadPool` class has gone
undocumented, despite being a public class in multiprocessing that is
included in `multiprocessing.pool.__all__`.
(cherry picked from commit 84ebcf2)

Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
@bedevere-bot

Copy link
Copy Markdown

GH-23835 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 18, 2020
Up until now, the `multiprocessing.pool.ThreadPool` class has gone
undocumented, despite being a public class in multiprocessing that is
included in `multiprocessing.pool.__all__`.
(cherry picked from commit 84ebcf2)

Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
@bedevere-bot

Copy link
Copy Markdown

GH-23836 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 18, 2020
Up until now, the `multiprocessing.pool.ThreadPool` class has gone
undocumented, despite being a public class in multiprocessing that is
included in `multiprocessing.pool.__all__`.
(cherry picked from commit 84ebcf2)

Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
miss-islington added a commit that referenced this pull request Dec 18, 2020
Up until now, the `multiprocessing.pool.ThreadPool` class has gone
undocumented, despite being a public class in multiprocessing that is
included in `multiprocessing.pool.__all__`.
(cherry picked from commit 84ebcf2)

Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
miss-islington added a commit that referenced this pull request Dec 18, 2020
…-23835)

Up until now, the `multiprocessing.pool.ThreadPool` class has gone
undocumented, despite being a public class in multiprocessing that is
included in `multiprocessing.pool.__all__`.
(cherry picked from commit 84ebcf2)


Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
ned-deily pushed a commit that referenced this pull request Dec 18, 2020
Up until now, the `multiprocessing.pool.ThreadPool` class has gone
undocumented, despite being a public class in multiprocessing that is
included in `multiprocessing.pool.__all__`.
(cherry picked from commit 84ebcf2)

Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
Up until now, the `multiprocessing.pool.ThreadPool` class has gone
undocumented, despite being a public class in multiprocessing that is
included in `multiprocessing.pool.__all__`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants