Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #2227 > unrolled thread

Re: multiprocessing Pool.imap broken?

Started by"eryksun ()" <eryksun@gmail.com>
First post2011-03-30 05:59 -0700
Last post2011-03-31 11:46 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Re: multiprocessing Pool.imap broken? "eryksun ()" <eryksun@gmail.com> - 2011-03-30 05:59 -0700
    Re: multiprocessing Pool.imap broken? Yang Zhang <yanghatespam@gmail.com> - 2011-03-31 11:46 -0700

#2227 — Re: multiprocessing Pool.imap broken?

From"eryksun ()" <eryksun@gmail.com>
Date2011-03-30 05:59 -0700
SubjectRe: multiprocessing Pool.imap broken?
Message-ID<17e12347-5f4f-4340-9436-a94cef63059e@glegroupsg2000goo.googlegroups.com>
On Tuesday, March 29, 2011 9:44:21 PM UTC-4, Yang Zhang wrote:
> I've tried both the multiprocessing included in the python2.6 Ubuntu
> package (__version__ says 0.70a1) and the latest from PyPI (2.6.2.1).
> In both cases I don't know how to use imap correctly - it causes the
> entire interpreter to stop responding to ctrl-C's.  Any hints?  Thanks
> in advance.
> 
> $ python
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
> [GCC 4.4.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import multiprocessing as mp
> >>> mp.Pool(1).map(abs, range(3))
> [0, 1, 2]
> >>> list(mp.Pool(1).imap(abs, range(3)))
> ^C^C^C^C^\Quit

It works fine for me on Win32 Python 2.7.1 with multiprocessing 0.70a1. So it's probably an issue with the implementation on Linux.

Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) 
[MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing as mp
>>> list(mp.Pool(1).imap(abs, range(3)))
[0, 1, 2]
>>> mp.__version__
'0.70a1'

[toc] | [next] | [standalone]


#2295

FromYang Zhang <yanghatespam@gmail.com>
Date2011-03-31 11:46 -0700
Message-ID<mailman.40.1301597213.2990.python-list@python.org>
In reply to#2227
The problem was that Pool shuts down from its finalizer:

http://stackoverflow.com/questions/5481104/multiprocessing-pool-imap-broken/5481610#5481610

On Wed, Mar 30, 2011 at 5:59 AM, eryksun () <eryksun@gmail.com> wrote:
> On Tuesday, March 29, 2011 9:44:21 PM UTC-4, Yang Zhang wrote:
>> I've tried both the multiprocessing included in the python2.6 Ubuntu
>> package (__version__ says 0.70a1) and the latest from PyPI (2.6.2.1).
>> In both cases I don't know how to use imap correctly - it causes the
>> entire interpreter to stop responding to ctrl-C's.  Any hints?  Thanks
>> in advance.
>>
>> $ python
>> Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
>> [GCC 4.4.3] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import multiprocessing as mp
>> >>> mp.Pool(1).map(abs, range(3))
>> [0, 1, 2]
>> >>> list(mp.Pool(1).imap(abs, range(3)))
>> ^C^C^C^C^\Quit
>
> It works fine for me on Win32 Python 2.7.1 with multiprocessing 0.70a1. So it's probably an issue with the implementation on Linux.
>
> Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46)
> [MSC v.1500 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import multiprocessing as mp
>>>> list(mp.Pool(1).imap(abs, range(3)))
> [0, 1, 2]
>>>> mp.__version__
> '0.70a1'
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Yang Zhang
http://yz.mit.edu/

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web