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


Groups > comp.lang.python > #82638

Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <torriem+gmail@torriefamily.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'finished,': 0.07; 'processing.': 0.07; 'callback': 0.09; 'http': 0.09; 'subject:using': 0.09; 'python': 0.11; 'gui': 0.12; 'thread': 0.14; 'blocking': 0.16; 'concurrency': 0.16; 'concurrent': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'subject:PyQt': 0.16; 'subject:user': 0.16; 'subject:when': 0.16; 'threads,': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'header:User- Agent:1': 0.23; 'looks': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'thus': 0.29; 'code': 0.31; 'usually': 0.31; 'probably': 0.32; 'core': 0.34; 'problem': 0.35; 'except': 0.35; 'but': 0.35; 'returning': 0.36; 'doing': 0.36; 'starting': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'bad': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'simply': 0.61; 'kind': 0.63; 'real': 0.63; 'such': 0.63; 'within': 0.65; 'between': 0.67; 'fact,': 0.69; 'sharing': 0.69; '*and*': 0.84; 'asynchronous': 0.84; 'fact.': 0.84
X-Virus-Scanned amavisd-new at torriefamily.org
Date Thu, 18 Dec 2014 09:29:14 -0700
From Michael Torrie <torriem@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11
MIME-Version 1.0
To python-list@python.org
Subject Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor
References <c9113f8e-ab16-4226-bd68-28c56a88aeda@googlegroups.com> <4f2a19ce-7642-4beb-9dd6-7771c6237a3f@googlegroups.com>
In-Reply-To <4f2a19ce-7642-4beb-9dd6-7771c6237a3f@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
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.17032.1418920169.18130.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1418920169 news.xs4all.nl 2832 [2001:888:2000:d::a6]:47078
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82638

Show key headers only | View raw


On 12/18/2014 04:16 AM, Mark Summerfield wrote:
> It looks to me that what you are doing is sharing a single core
> between your GUI and your processing. Threading isn't usually a good
> approach to Python concurrency that is CPU-bound.

Except that his code was not CPU-bound to begin with.  His real problem
is that his callback is starting *and* waiting for all the threads to do
their work without returning to the main loop, thus blocking the GUI.
As for the threads, they are I/O bound--he's simply trying to do
concurrent HTTP downloads.  So blocking in the GIL is not the issue
here.  In fact, in lieu of using proper asynchronous I/O, threading of
some kind is probably not a bad solution here, but he has to do it
within the Qt Framework, using signals to notify the GUI when a thread
is finished, or using a synchronization primitive such as a queue, as
recommended by your book in fact.

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


Thread

PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor iMath <redstone-cold@163.com> - 2014-12-10 20:52 -0800
  Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Michael Torrie <torriem@gmail.com> - 2014-12-10 22:25 -0700
    Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor iMath <redstone-cold@163.com> - 2014-12-11 19:20 -0800
      Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Michael Torrie <torriem@gmail.com> - 2014-12-11 23:07 -0700
        Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Marko Rauhamaa <marko@pacujo.net> - 2014-12-12 09:18 +0200
          Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Chris Angelico <rosuav@gmail.com> - 2014-12-12 18:42 +1100
            Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Marko Rauhamaa <marko@pacujo.net> - 2014-12-12 10:43 +0200
  Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Mark Summerfield <list@qtrac.plus.com> - 2014-12-18 03:16 -0800
    Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Michael Torrie <torriem@gmail.com> - 2014-12-18 09:29 -0700

csiph-web