[python-tulip] StreamWriter.drain cannot be called concurrently

2015-06-11 Thread Martin Teichmann
Hi everyone, StreamWriter.drain cannot be called from different tasks (asyncio tasks that is) at the same time. It raises an assertion error. I added a script that shows this problem. What I am doing is the following: several tasks in my program are generating big amounts of data to be shipped

Re: [python-tulip] StreamWriter.drain cannot be called concurrently

2015-06-11 Thread Gustavo Carneiro
On 11 June 2015 at 10:55, Paul Sokolovsky pmis...@gmail.com wrote: Hello, On Thu, 11 Jun 2015 02:05:23 -0700 (PDT) Martin Teichmann martin.teichm...@gmail.com wrote: [] What I am doing is the following: several tasks in my program are generating big amounts of data to be shipped out on

Re: [python-tulip] StreamWriter.drain cannot be called concurrently

2015-06-11 Thread Gustavo Carneiro
On 11 June 2015 at 11:36, Paul Sokolovsky pmis...@gmail.com wrote: Hello, On Thu, 11 Jun 2015 11:04:56 +0100 Gustavo Carneiro gjcarne...@gmail.com wrote: [] What I am doing is the following: several tasks in my program are generating big amounts of data to be shipped out on a

Re: [python-tulip] StreamWriter.drain cannot be called concurrently

2015-06-11 Thread Paul Sokolovsky
Hello, On Thu, 11 Jun 2015 02:05:23 -0700 (PDT) Martin Teichmann martin.teichm...@gmail.com wrote: [] What I am doing is the following: several tasks in my program are generating big amounts of data to be shipped out on a StreamWriter. This can easily overload the receiver of all that data.

Re: [python-tulip] StreamWriter.drain cannot be called concurrently

2015-06-11 Thread Paul Sokolovsky
Hello, On Thu, 11 Jun 2015 11:04:56 +0100 Gustavo Carneiro gjcarne...@gmail.com wrote: [] What I am doing is the following: several tasks in my program are generating big amounts of data to be shipped out on a StreamWriter. This can easily overload the receiver of all that data. This

[python-tulip] Re: StreamWriter.drain cannot be called concurrently

2015-06-11 Thread Martin Teichmann
Hi everyone, StreamWriter.drain cannot be called from different tasks (asyncio tasks that is) at the same time. I just filed a bug fix for this problem here: http://bugs.python.org/issue24431 Greetings Martin

[python-tulip] Re: Thread safety

2015-06-11 Thread Andrew Svetlov
Published [janus](https://pypi.python.org/pypi/janus/0.0.1) -- thread-safe and async-aware queue with limited capacity, as you requested :) On Saturday, February 28, 2015 at 2:55:59 AM UTC+3, Tin Tvrtković wrote: I was contemplating this just now. Let's say you want to stream a (huge) file

Stream.async_write() method, was, Re: [python-tulip] StreamWriter.drain cannot be called concurrently

2015-06-11 Thread Paul Sokolovsky
Hello, On Thu, 11 Jun 2015 12:39:09 +0100 Gustavo Carneiro gjcarne...@gmail.com wrote: [] By the end, to state the obvious, I don't call to do something about existing synchronous write() - just for adding missing async one, and letting people decide what they want to use. Yes. But

Stream.async_write() method, was, Re: [python-tulip] StreamWriter.drain cannot be called concurrently

2015-06-11 Thread Paul Sokolovsky
Hello, On Thu, 11 Jun 2015 04:36:42 -0700 (PDT) Martin Teichmann martin.teichm...@gmail.com wrote: Hello, And I personally would have real hard time explaining people while read operation should be called with yield from (or await soon), while its counterpart write - without.

[python-tulip] Re: Question on orderly shutdown of running tasks

2015-06-11 Thread Alan Yorinks
Hi Martin, Thanks so much for the pointer to that link. That seemed to do the trick. Alan On Thursday, June 11, 2015 at 4:48:57 AM UTC-4, Martin Teichmann wrote: Hi Alan, I have an application that uses a task to continuously read data from a serial device. This task is invoked with

Re: [python-tulip] Re: Question on orderly shutdown of running tasks

2015-06-11 Thread Skip Montanaro
I wonder if something akin to daemon threads would be appropriate here (daemon tasks?). When the last non-daemon task completes, the program can exit. Skip

Re: [python-tulip] StreamWriter.drain cannot be called concurrently

2015-06-11 Thread Glyph
On Jun 11, 2015, at 2:05 AM, Martin Teichmann martin.teichm...@gmail.com mailto:martin.teichm...@gmail.com wrote: StreamWriter.drain cannot be called from different tasks (asyncio tasks that is) at the same time. It raises an assertion error. I added a script that shows this problem.

Re: [python-tulip] StreamWriter.drain cannot be called concurrently

2015-06-11 Thread Gustavo Carneiro
On 11 June 2015 at 14:37, David Keeney dkee...@travelbyroad.net wrote: This may be relevant to the current discussion, but whenever I see this snippet: s.write(data) yield from s.drain() I think the sequence is backward, in that it should be like: yield from s.drain()# ensure