Message245878
The following example should start two processes, but instead it starts three, even though only two do_work(). A third process is incorrectly started after the first one finishes.
import os
import time
from multiprocessing import Pool
def initprocess():
print("Starting PID: %d" % os.getpid())
def do_work(x):
print("Doing work in %d" % os.getpid())
time.sleep(x**2)
if __name__ == '__main__':
p = Pool(2, initializer=initprocess,maxtasksperchild=1)
results = p.map(do_work, (1,2), chunksize=1) |
|
Date |
User |
Action |
Args |
2015-06-27 09:22:06 | Zahari.Dim | set | recipients:
+ Zahari.Dim |
2015-06-27 09:22:06 | Zahari.Dim | set | messageid: <1435396926.55.0.634788943007.issue24519@psf.upfronthosting.co.za> |
2015-06-27 09:22:06 | Zahari.Dim | link | issue24519 messages |
2015-06-27 09:22:05 | Zahari.Dim | create | |
|