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


Groups > comp.lang.python > #38026

Python 2 multiprocessing examples in docs.python.org

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 <spaxe85@gmail.com>
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 <contact@xavierho.com>
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" <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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1270.1359692111.2939.python-list@python.org> (permalink)
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

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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 <module>
    test()
  File "test.py", line 295, in test
    assert not worker.is_alive()
AssertionError

The relevant example code reads:

    pool = multiprocessing.Pool(2)
    DELTA = 0.1
    processes = pool._pool
    ignore = pool.apply(pow3, [2])
    results = [pool.apply_async(time.sleep, [DELTA]) for i in range(100)]

    results = pool = 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 ❖ /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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Python 2 multiprocessing examples in docs.python.org Xavier Ho <contact@xavierho.com> - 2013-02-01 15:14 +1100

csiph-web