[AstroPy] A question about multiprocessing
Fri Nov 4 10:51:37 CDT 2011
I'm not sure this code is doing what you want. Each of NPROC subprocesses runs CatDistort(), which does some processing on EACH image in your queue. So each image actually gets processed NPROC times (by every subprocess), is that your intention? If not, send one image as the value for the args of CatDistort().
On 11/4/11 10:45 AM, Jean-Baptiste Marquette wrote:
> 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'):
> queue = multi.Queue()
> for Image in glob.glob(DirImg + '*r.sdf'):
> print os.path.basename(Image), 'queued'
> Jobs = 
> for i in range(NPROC):
> proc= multi.Process(target=CatDistort, args=[queue])
> for job in Jobs:
> print'Process completed'
> 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,
> AstroPy mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the AstroPy