[Async-sig] Asyncio loop instrumentation

Yury Selivanov yselivanov at gmail.com
Tue Jan 2 12:46:04 EST 2018


I understand why it could be useful to have this in asyncio. But I'm big -1 on rushing this functionality in 3.7.

asyncio is no longer provisional, so we have to be careful when we design new APIs for it.

Example: I wanted to add support for Task groups to asyncio. A similar concept exists in curio and trio and I like it, it can be a big improvement over asyncio.gather. But there are too many caveats about handling multiple exceptions properly (MultiError?) and some issues with cancellation. That's why I decided that it's safer to prototype TaskGroups in a separate package, than to push a poorly thought out new API in 3.7.

Same applies to your proposal. You can easily publish a package on PyPI that provides an improved version of asyncio event loop. You won't even need to write a lot of code, just overload a few methods.

Yury

Sent from my iPhone

> On Jan 2, 2018, at 8:00 PM, Pau Freixes <pfreixes at gmail.com> wrote:
> 
> Agree, poll_start and poll_end suit much better.
> 
> Thanks for the feedback.
> 
> On Tue, Jan 2, 2018 at 1:34 AM, INADA Naoki <songofacandy at gmail.com> wrote:
>>>>> For this proposal [4], POC, I've preferred make a reduced list of events:
>>>>> 
>>>>> * `loop_start` : Executed when the loop starts for the first time.
>>>>> * `tick_start` : Executed when a new loop tick is started.
>>>>> * `io_start` : Executed when a new IO process starts.
>>>>> * `io_end` : Executed when the IO process ends.
>>>>> * `tick_end` : Executed when the loop tick ends.
>>>>> * `loop_stop` : Executed when the loop stops.
>>>> 
>>>> What do you call a "IO process" in this context?
>>> 
>>> Basically the call to the `select/poll/whatever` syscall that will ask
>>> for read or write to a set of file descriptors.
>> 
>> `select/poll/whatever` syscalls doesn't ask for read or write.
>> It waits for read or write (more accurate, waits for readable or
>> writable state).
>> 
>> So poll_start / poll_end looks better name to me.
>> 
>> INADA Naoki  <songofacandy at gmail.com>
>> 
>> 
>>> 
>>> Thanks,
>>> 
>>> --
>>> --pau
>>> _______________________________________________
>>> Async-sig mailing list
>>> Async-sig at python.org
>>> https://mail.python.org/mailman/listinfo/async-sig
>>> Code of Conduct: https://www.python.org/psf/codeofconduct/
> 
> 
> 
> -- 
> --pau
> _______________________________________________
> Async-sig mailing list
> Async-sig at python.org
> https://mail.python.org/mailman/listinfo/async-sig
> Code of Conduct: https://www.python.org/psf/codeofconduct/


More information about the Async-sig mailing list