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


Groups > comp.lang.python > #102176 > unrolled thread

Re: Question about asyncio and blocking operations

Started by"Frank Millman" <frank@chagford.com>
First post2016-01-28 11:13 +0200
Last post2016-01-28 11:13 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Question about asyncio and blocking operations "Frank Millman" <frank@chagford.com> - 2016-01-28 11:13 +0200

#102176 — Re: Question about asyncio and blocking operations

From"Frank Millman" <frank@chagford.com>
Date2016-01-28 11:13 +0200
SubjectRe: Question about asyncio and blocking operations
Message-ID<mailman.45.1453972447.2338.python-list@python.org>
"Ian Kelly"  wrote in message 
news:CALwzidkr-fT6S6wH2caNaxyQvUdAw=x7XDqkqOfNRrwzwnjvOQ@mail.gmail.com...
>
> On Wed, Jan 27, 2016 at 10:14 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> > Unfortunately this doesn't actually work at present.
> > EventLoop.run_in_executor swallows the StopIteration exception and
> > just returns None, which I assume is a bug.
>
> http://bugs.python.org/issue26221
>

Thanks for that. Fascinating discussion between you and GvR.

Reading it gave me an idea.

Run the database handler in a separate thread. Use a queue.Queue to send 
requests to the handler. Use an asyncio.Queue to send results back to the 
caller, which can call 'await q.get()'.

I ran a quick test and it seems to work. What do you think?

Frank


[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web