Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python 2 multiprocessing examples in docs.python.org

Reply
Thread Tools

Python 2 multiprocessing examples in docs.python.org

 
 
Xavier Ho
Guest
Posts: n/a
 
      02-01-2013
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.Net Tips, C# Tips : Get list of all files of directory or folderusing LINQ using .Net Framework 4 with C# Examples and VB.Net Examples jayeshsorathia@gmail.com ASP .Net 0 07-27-2012 07:13 AM
examples of realistic multiprocessing usage? TomF Python 16 01-21-2011 09:34 PM
RESUME EXAMPLES INFORMATION / CV EXAMPLES NOW AVAILABLE THROUGHRESUMEWRITERGUIDE.COM rawebadvert3 Computer Support 0 03-23-2008 04:19 AM
COVER LETTERS RESUME EXAMPLES AND CV EXAMPLES AVAILABLE CURRICULUM VITAE rawebadvert3 Computer Support 0 08-21-2007 03:07 AM
COVER LETTERS RESUME EXAMPLES AND CV EXAMPLES AVAILABLE rawebadvert3 Computer Support 0 05-25-2007 04:18 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57