Re: [python-tulip] Best way to read/write files with AsyncIO

2015-01-13 Thread Saúl Ibarra Corretgé
On 01/13/2015 05:34 PM, Guido van Rossum wrote: > Interesting blog. The gist seems to be to use a thread pool for disk > operations instead of AOI. This translates fairly directly to > Tulip/Trollius, using the run_in_executor() operation. It's pretty clear > to me that Windows IOCP does support as

Re: [python-tulip] Best way to read/write files with AsyncIO

2015-01-13 Thread Guido van Rossum
Interesting blog. The gist seems to be to use a thread pool for disk operations instead of AOI. This translates fairly directly to Tulip/Trollius, using the run_in_executor() operation. It's pretty clear to me that Windows IOCP does support async operations on disk files, so it would behoove us to

Re: [python-tulip] Best way to read/write files with AsyncIO

2015-01-13 Thread Victor Stinner
2015-01-13 16:24 GMT+01:00 Saúl Ibarra Corretgé : > libuv (Node's platform layer) core dev here. That's right all filesystem > operations are run in a threadpool, much like asyncio runs getaddrinfo > in a ThreadPoolExecutor. > > Here is an interesting read: > http://blog.libtorrent.org/2012/10/asyn

Re: [python-tulip] Best way to read/write files with AsyncIO

2015-01-13 Thread Saúl Ibarra Corretgé
On 01/13/2015 03:54 PM, Luciano Ramalho wrote: > Reviving the thread... if I understand correctly, there is no portable > way to do disk I/O asynchronously (and the gist [1] provided by the OP > is bogus: the read_data function will block the event loop). Is my > understanding correct? > > [1] htt

Re: [python-tulip] Best way to read/write files with AsyncIO

2015-01-13 Thread Andrew Svetlov
1. Yes, file functions from your gist do block event loop. 2. Yes, portable nonblocking file API should be built on threads. Or, as an option, you can make *actually blocking* code with *nonblocking interface* if you like coroutines so much. On Tue, Jan 13, 2015 at 4:54 PM, Luciano Ramalho wrote:

Re: [python-tulip] Best way to read/write files with AsyncIO

2015-01-13 Thread Luciano Ramalho
Reviving the thread... if I understand correctly, there is no portable way to do disk I/O asynchronously (and the gist [1] provided by the OP is bogus: the read_data function will block the event loop). Is my understanding correct? [1] https://gist.github.com/kunev/f83146d407c81a2d64a6

Re: [python-tulip] Best way to read/write files with AsyncIO

2014-08-26 Thread Glyph
If anyone is curious about the abysmal state of asynchronous file I/O in popular operating systems, this question I asked on Stack Overflow a while back has got some really excellent answers on it: . -gl

Re: [python-tulip] Best way to read/write files with AsyncIO

2014-08-25 Thread Guido van Rossum
On most OSes, select() and other polling APIs always report disk files to be "ready", so you basically can't use asyncio with them. On Windows it will fail; on *n*x it will appear to work but actually you are doing the whole thing synchronously. The only way to overlap disk I/O with asyncio events

[python-tulip] Best way to read/write files with AsyncIO

2014-08-25 Thread Ludovic Gasc
Hi, I'm looking for the best way to read/write files with AsyncIO. Ideally, I want to r/w asynchronously, like with network. I've found this: https://gist.github.com/kunev/f83146d407c81a2d64a6 Is it ok, or do you have a better suggestion ? Regards.