Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Managing Processes from Python multiprocessing module

Current License: CC BY-SA 3.0

Post Revisions

9 events
when toggle format what by license comment
Oct 22, 2014 at 4:09 vote accept Community Bot moved from User.Id=1529891 by developer User.Id=811
Oct 22, 2014 at 4:01 answer added dano timeline score: 6
Oct 22, 2014 at 3:53 comment added dano Nope. It just calls it once. To call it for every process in the pool, you'd need to do for _ in range(pool._processes): pool.apply_async(myfunc, callback=cb). Or, if you make myfunc take a single argument (which you could ignore), you could do: SOME_LIST = pool.map(myfunc, range(pool._processes))
Oct 22, 2014 at 3:47 comment added dano I'm confused. Why do you expect a list of results from the above example? You're just calling apply_async once, which means you're just calling myfunc a single time in one of the worker processes. What are you expecting to happen?
Oct 22, 2014 at 3:45 history edited user1529891 CC BY-SA 3.0
added 420 characters in body
Oct 21, 2014 at 20:36 history edited user1529891 CC BY-SA 3.0
added 711 characters in body
Oct 21, 2014 at 20:35 comment added dano I'm not sure if this is what you mean, but this works fine, too: return_value = pool.apply(func). Where func is def func(): return 12345. return_value will be assigned to the 12345 returned by func.
Oct 21, 2014 at 15:59 comment added dano Using a Pool is the correct way. You should be able to get the return value of each completed worker Process, too : return_value = pool.apply(func, args=(arg1, arg2). Can you share the code you're trying to use that isn't working?
Oct 21, 2014 at 13:12 history asked user1529891 CC BY-SA 3.0

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