[New-bugs-announce] [issue22600] In Multiprocessing Queue() doesn't work with list : __.put(list) != __.get()
CALMET
report at bugs.python.org
Fri Oct 10 13:53:13 CEST 2014
New submission from CALMET:
Hello,
I have to find the right order of a list, for example
try = [0,1,2,3,4,5,6,7,8,9]
try = [0,1,2,3,4,5,6,7,9,8]
try = [0,1,2,3,4,5,6,8,7,9]
and so on... in this example there are factorial(10) = 3,6 million possible order to test.
The results with be all the list 'try' that match with the test.
To go faster
- I use mutiproceesiing
- I define rightorder = Queue()
- I define a function test with a line rightorder.put(try)
- I wait for all the processes are finished p.join()
- Then I read all the results in the main programm rightorder.get()
The problem is that on exactly the same example
- the rightorder.put() found by the process are always good
- but the rightorder.get() in the main programm can be different (randomly).
I first believed that when 2 processes call the function rightorder.put(try) at the same time, the lists ares mixed together in the Queue().
But even when I force cpu_count() to 1 (mono process) I still have the problem.
To solve the problem I converted the list try=[2,3,0,4,2,9,7,8,1,5]
in a string try2="2304297815"
and since now rightorder.put(try) and rightorder.get() always give the same results.
So I suppose that in multiprocessing with a Queue() rightorder.put(try) works if try is a number or a string
but doesn't works if try is a list.
----------
files: BisesAmouRmulti-debug.py
messages: 228993
nosy: AlainCALMET
priority: normal
severity: normal
status: open
title: In Multiprocessing Queue() doesn't work with list : __.put(list) != __.get()
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file36865/BisesAmouRmulti-debug.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22600>
_______________________________________
More information about the New-bugs-announce
mailing list