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


Groups > comp.lang.python > #74531

Re: multiprocessing problem: queue.get() not finding pushed values

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; '16,': 0.03; 'string': 0.09; '"__main__":': 0.09; '__name__': 0.09; 'method,': 0.09; 'msg': 0.09; 'none)': 0.09; 'runs': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'charles': 0.16; 'empty,': 0.16; 'expect,': 0.16; 'for,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'helps!': 0.16; 'quoted': 0.16; 'subject:skip:m 10': 0.16; 'subject:values': 0.16; 'unchanged': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'module': 0.19; 'example': 0.22; 'import': 0.22; 'putting': 0.22; 'cc:addr:python.org': 0.22; 'subject:problem': 0.24; 'cc:2**0': 0.24; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'dropped': 0.31; 'omitted': 0.31; 'except': 0.35; 'case,': 0.35; 'definition': 0.35; 'received:google.com': 0.35; 'starting': 0.37; 'anything': 0.39; 'sure': 0.39; 'changed': 0.39; 'hope': 0.61; 'full': 0.61; 'simply': 0.61; "you're": 0.61; 'jul': 0.74; 'cutting': 0.91; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=jKjNHYBIIYGBKy29G6Q5DmpcfTtU5w5bWnL8iDxe3Kg=; b=hXzAwPdeoQHmQJJnc+2vnrQoQwvzesoxKJhWEC0u+uWuBdAahF3vKoE3I1gJnkK712 eo6q8t39gTUVHQv8e1rgB/a4/jZ9bxOyZGfB9QVX+do9hOEzJWPLg1Husr3cL6aM6Qwn gzlCaY8exWv+lvD1EwTe3rIwIoCQFm/KU2PWpcj4VeQfCO7wRVwyNuxb5FkUzeSEgoKO jcuWflGQ60Ry0ZpIiekfwhqnnVX1EpQGkkKojW0nSQoidGTAq2W+OFiVy2NTjL4okoQt 6FrsnE3+O3Zt6uIyFmZsc/VApvCVW60dTGVqyG6UoWHbXL7LOkrSrL/2OiNQnnnea8vb OjTg==
MIME-Version 1.0
X-Received by 10.52.33.202 with SMTP id t10mr50487vdi.97.1405484801814; Tue, 15 Jul 2014 21:26:41 -0700 (PDT)
In-Reply-To <53C58FC8.2030202@earthlink.net>
References <53C58FC8.2030202@earthlink.net>
Date Wed, 16 Jul 2014 14:26:41 +1000
Subject Re: multiprocessing problem: queue.get() not finding pushed values
From Chris Angelico <rosuav@gmail.com>
Cc Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11862.1405484811.18130.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1405484811 news.xs4all.nl 2858 [2001:888:2000:d::a6]:42262
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:74531

Show key headers only | View raw


On Wed, Jul 16, 2014 at 6:32 AM, Charles Hixson
<charleshixsn@earthlink.net> wrote:
> from queue import Empty, Full

Not sure what this is for, you never use those names (and I don't have
a 'queue' module to import from). Dropped that line. In any case, I
don't think it's your problem...

> if __name__ == "__main__":
>     dbw    =    DBW(DBW_to, DBW_from)
>     dbw.run()
>     DBW_to.put(Msg("a", 1, wrd) )
>     DBW_to.put(Msg("b", 2, wrd) )
>     DBW_to.put(Msg("c", 0, None) )

... which is here. You're not starting a subprocess; you're simply
calling a method, so it runs synchronously. When you call .run(), it
runs the "subprocess" to completion, which then bombs because the
queue's empty, and then never gets to putting anything onto it. Change
that .run() to .start() and it'll do as you expect, except that as
part of cutting the example down you seem to have omitted the
definition of wrd. I changed that to a quoted string and it works:

# chomp unchanged code ...
if __name__ == "__main__":
    dbw    =    DBW(DBW_to, DBW_from)
    dbw.start()
    DBW_to.put(Msg("a", 1, 'wrd') )
    DBW_to.put(Msg("b", 2, 'wrd') )
    DBW_to.put(Msg("c", 0, None) )

rosuav@sikorsky:~$ python test7a.py
msg = Msg(act='a', id=1, vals='wrd')

Hope that helps!

ChrisA

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


Thread

Re: multiprocessing problem: queue.get() not finding pushed values Chris Angelico <rosuav@gmail.com> - 2014-07-16 14:26 +1000

csiph-web