Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'skip:[ 20': 0.03; 'subject:Python': 0.05; 'python': 0.09; '0.1': 0.09; 'garbage': 0.09; 'python:': 0.09; 'subject:skip:m 10': 0.09; 'ignore': 0.13; '"testing': 0.16; '2.7.3': 0.16; '3)]': 0.16; 'from:addr:xavierho.com': 0.16; 'from:name:xavier ho': 0.16; 'sender:addr:spaxe85': 0.16; 'test()': 0.16; 'sender:addr:gmail.com': 0.18; 'to:name:python-list@python.org': 0.20; 'all,': 0.21; 'hey': 0.21; 'delta': 0.22; 'work,': 0.22; 'cheers,': 0.23; 'example': 0.23; '(most': 0.27; 'subject:skip:d 10': 0.27; 'message-id:@mail.gmail.com': 0.27; 'skip:( 20': 0.28; 'assert': 0.29; 'skip:& 10': 0.29; 'code': 0.31; 'file': 0.32; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'skip:& 20': 0.33; 'received:google.com': 0.34; 'test': 0.36; 'should': 0.36; 'does': 0.37; 'mean': 0.38; 'to:addr:python.org': 0.39; 'build': 0.39; 'skip:w 30': 0.61; 'more': 0.63; 'results': 0.65; 'header:Reply- To:1': 0.68; 'reply-to:no real name:2**0': 0.72; '4.2.1': 0.84; 'been?': 0.84; 'reply-to:addr:contact': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:reply-to:sender:from:date :x-google-sender-auth:message-id:subject:to:content-type; bh=r++drKIvfpkkld/OVCxjYk1luKEuDqH1iD6PW9/KBmU=; b=xKbS7C3eZYVGSaq3bV5gFTP3UEKck3Y3xDiizuLW9rXV5/X6PrSpHKakE0r9HDVvWP oZOulM5lG7qofbxKnlG4uVrizU4pRcHEBEs8Ac7dcSE2phLd+uGBi1cAZU/m5lD4E1gR Ku+KNLFLrxvPoFfyKo7Qr7i4LLZG1kh1WkgwlLzx5L5T5Rly9ZM0V3q6T4q9X7y4U7Rq Zf8Bqo0YMY3D93F+HBqt2csEOAN588ilxMmo34c/gl2FqdjyncXbeCVXJzefHu6N4W1e IXgw1Q88ZEZg7Uxsz6GtvRsLJOJbg2KDbgSBI4yWJ31BfQ7vzoiOWuulSvjBvM20VC+0 RgOg== X-Received: by 10.112.98.71 with SMTP id eg7mr4204532lbb.133.1359692109159; Thu, 31 Jan 2013 20:15:09 -0800 (PST) MIME-Version: 1.0 Sender: spaxe85@gmail.com From: Xavier Ho Date: Fri, 1 Feb 2013 15:14:49 +1100 X-Google-Sender-Auth: XWcD55Ts_vEJ1Ss3V6TzIeeCrCY Subject: Python 2 multiprocessing examples in docs.python.org To: "python-list@python.org" Content-Type: multipart/alternative; boundary=f46d04016a752b9ea704d4a1fd8a X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: contact@xavierho.com List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 104 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1359692111 news.xs4all.nl 6911 [2001:888:2000:d::a6]:37103 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38026 --f46d04016a752b9ea704d4a1fd8a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hey all, I ran the example code on multiprocessing. On the "Pool example", an assertion failed with "testing garbage collection". Traceback (most recent call last): File "test.py", line 314, in test() File "test.py", line 295, in test assert not worker.is_alive() AssertionError The relevant example code reads: pool =3D multiprocessing.Pool(2) DELTA =3D 0.1 processes =3D pool._pool ignore =3D pool.apply(pow3, [2]) results =3D [pool.apply_async(time.sleep, [DELTA]) for i in range(100)] results =3D pool =3D None time.sleep(DELTA * 2) for worker in processes: assert not worker.is_alive() My questions are 1) How does that GC test work, and 2) Does that mean my GC isn't working as fast as it should have been? The machine's Python: xav =E2=9D=96 /tmp > python Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. Cheers, Xav --f46d04016a752b9ea704d4a1fd8a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hey all,

I ran the example code o= n multiprocessing. =C2=A0On the "Pool example", an assertion fail= ed with "testing garbage collection".

<= div style>
Traceback (most recent call last= ):
=C2=A0 File "= ;test.py", line 314, in <module>
=C2=A0 =C2=A0 test()
=C2=A0 File "test.py",= line 295, in test
= =C2=A0 =C2=A0 assert not worker.is_alive()
AssertionError

The relevant example code reads:
=
=C2=A0 =C2= =A0 pool =3D multiprocessing.Pool(2)
=C2=A0 =C2=A0 DELTA =3D 0.1
=C2=A0 =C2=A0 processes =3D pool= ._pool
=C2=A0 =C2=A0= ignore =3D pool.apply(pow3, [2])
=C2=A0 =C2=A0 results =3D [pool.apply_async(time.sleep, [DELT= A]) for i in range(100)]

=C2=A0 =C2=A0 results =3D pool =3D None<= /div>

=C2=A0 =C2=A0 time.sleep(DELTA * 2)=

=C2=A0 =C2=A0 for worker in processes:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = assert not worker.is_alive()

My questions are 1) How does th= at GC test work, and 2) Does that mean my GC isn't working as fast as i= t should have been?

The machine's Python= :

= xav =E2=9D=96 /tmp =C2=A0> python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr =C2=A09 2012, 20:52= :43)=C2=A0
[GCC 4.2.1 (Apple Inc. build 566= 6) (dot 3)] on darwin
Cheers,
Xav
--f46d04016a752b9ea704d4a1fd8a--