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


Groups > comp.lang.python > #86238

Re: Question on asyncio

From Marko Rauhamaa <marko@pacujo.net>
Newsgroups comp.lang.python
Subject Re: Question on asyncio
Date 2015-02-23 18:30 +0200
Organization A noiseless patient Spider
Message-ID <87a904d1za.fsf@elektro.pacujo.net> (permalink)
References <52b94569-1480-4a05-a58f-13c2cb19229a@googlegroups.com> <8761atiqvt.fsf@elektro.pacujo.net> <5c9fa6a5-f92a-42a8-a760-9477f9d8d0d2@googlegroups.com> <87k2z8dagc.fsf@elektro.pacujo.net> <mailman.19074.1424703937.18130.python-list@python.org>

Show all headers | View raw


Jonas Wielicki <jonas@wielicki.name>:

> On 23.02.2015 14:27, Marko Rauhamaa wrote:
>> pfranken85@gmail.com:
>>> The corresponding call is a call to the python smbus library. It
>>> includes several sleeps (even though they are only about 50ms).
>>> Therefore I think it is worthwhile to encapsulate it into a coroutine.
>> 
>> Maybe. Then you'll probably have to rewrite smbus to work asyncio style.
>> Those sleeps would then be done as "yield from" statements.
>> 
>
> The manual has a word on this [1]. So I would suggest to use
> run_in_executor() instead of trashing and rewriting the whole smbus
> library.

Ok, that's always a fallback. I usually isolate such obnoxious function
calls in a process pool.

But that wouldn't be purely asyncio anymore.

One of the main offenders is the database libraries. They should
definitely provide nonblocking access.


Marko

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


Thread

Question on asyncio pfranken85@gmail.com - 2015-02-22 09:47 -0800
  Re: Question on asyncio Marko Rauhamaa <marko@pacujo.net> - 2015-02-22 23:21 +0200
    Re: Question on asyncio pfranken85@gmail.com - 2015-02-23 01:48 -0800
      Re: Question on asyncio Marko Rauhamaa <marko@pacujo.net> - 2015-02-23 15:27 +0200
        Re: Question on asyncio Jonas Wielicki <jonas@wielicki.name> - 2015-02-23 16:05 +0100
          Re: Question on asyncio Marko Rauhamaa <marko@pacujo.net> - 2015-02-23 18:30 +0200

csiph-web