Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for multiprocessing - Pool.apply() #48843

Closed
beazley mannequin opened this issue Dec 8, 2008 · 4 comments
Closed

Documentation for multiprocessing - Pool.apply() #48843

beazley mannequin opened this issue Dec 8, 2008 · 4 comments
Labels
docs Documentation in the Doc dir easy

Comments

@beazley
Copy link
Mannequin

beazley mannequin commented Dec 8, 2008

BPO 4593
Nosy @birkenfeld

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2009-01-22.22:06:46.666>
created_at = <Date 2008-12-08.15:45:19.338>
labels = ['easy', 'docs']
title = 'Documentation for multiprocessing - Pool.apply()'
updated_at = <Date 2009-01-22.22:06:46.665>
user = 'https://bugs.python.org/beazley'

bugs.python.org fields:

activity = <Date 2009-01-22.22:06:46.665>
actor = 'jnoller'
assignee = 'jnoller'
closed = True
closed_date = <Date 2009-01-22.22:06:46.666>
closer = 'jnoller'
components = ['Documentation']
creation = <Date 2008-12-08.15:45:19.338>
creator = 'beazley'
dependencies = []
files = []
hgrepos = []
issue_num = 4593
keywords = ['easy']
message_count = 4.0
messages = ['77312', '77316', '77336', '80385']
nosy_count = 3.0
nosy_names = ['georg.brandl', 'beazley', 'jnoller']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'needs patch'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue4593'
versions = ['Python 2.6', 'Python 3.0', 'Python 2.7']

@beazley
Copy link
Mannequin Author

beazley mannequin commented Dec 8, 2008

The documentation for the apply() and apply_async() methods of a Pool
object might emphasize that these operations execute func(*args,**kwargs)
in only one of the pool workers and that func() is not being executed in
parallel on all workers. On first reading, I actually thought it might
be the latter (and had to do some experimentation to figure out what was
actually happening).

@beazley beazley mannequin assigned birkenfeld Dec 8, 2008
@beazley beazley mannequin added the docs Documentation in the Doc dir label Dec 8, 2008
@tiran tiran added the easy label Dec 8, 2008
@tiran tiran assigned jnoller and unassigned birkenfeld Dec 8, 2008
@jnoller
Copy link
Mannequin

jnoller mannequin commented Dec 8, 2008

Ah, I see what you're talking about David. Good catch. It wouldn't make
sense to run the apply() in all of the workers, as apply() is a single
function(...) call. map() however is done in parallel amongst all workers.

@beazley
Copy link
Mannequin Author

beazley mannequin commented Dec 8, 2008

Actually, you shouldn't discount the potential usefulness of running
apply() in all of the worker nodes. A lot of people coming from
parallel programming know about things like global broadcasts,
reductions, and so forth. For example, if I wanted to perform a global
operation (maybe some kind of configuration) on all workers, I could see
doing some kind of global apply() operation to do it.

That said, I'm not actually asking for any new functionality. I'd just
make it more clear that apply() is not performing a function call on all
pool workers.

Also, given that apply() blocks, I'm not exactly sure how useful it is
in the context of actually performing work in parallel. You might want
to emphasize that apply_async() is better suited for that (the only
other way I could think of to take advantage of apply() in parallel
would be to call it from separate threads in the process that created
the pool).

@jnoller
Copy link
Mannequin

jnoller mannequin commented Jan 22, 2009

fixed in trunk, r68862, merged to 3k in r68863

@jnoller jnoller mannequin closed this as completed Jan 22, 2009
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
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 easy
Projects
None yet
Development

No branches or pull requests

2 participants