[AstroPy] A question about multiprocessing

Jean-Baptiste Marquette marquett at iap.fr
Fri Nov 4 10:45:06 EDT 2011


Dear Python gurus,

I'm not sure to be on the right mailing list, but I have the following problem:

I have this code ran from Eclipse/PyDev:

import multiprocessing as multi

def CatDistort(queue):
    for Image in iter(queue.get, 'STOP'):
	etc...

queue = multi.Queue()

for Image in glob.glob(DirImg + '*r.sdf'):
    queue.put(Image)
    print os.path.basename(Image), 'queued'
queue.put('STOP')

Jobs = []
for i in range(NPROC):
    proc= multi.Process(target=CatDistort, args=[queue])
    Jobs.append(proc)
    proc.start()
    
for job in Jobs:
    job.join(360)

print 'Process completed'
exit(0)

The target and the queue work well, but the process never terminates. In other words, the final print is never displayed.

Any hint ?
Thanks for your help,

Cheers
Jean-Baptiste

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20111104/3357f3b4/attachment.html>


More information about the AstroPy mailing list