On Thu, Mar 19, 2015 at 3:23 AM, Martin Teichmann <
martin.teichm...@gmail.com> wrote:

> Hi everybody,
>
> Hum, maybe this is an important issue in your application. The
>> producer should not raise an exception but *wait* until the consumer
>> read some items from the queue.
>>
>
> No. Certainly not. In my application, the consumer needs always to
> be fast enough (on the long run) to process the data. Otherwise
> I have a BIG problem. And I want to be notified of that problem,
> with a nice exception, so that I can check my code and make it
> fast enough to do the job (or buy better hardware...). The data
> produced is coming from the real world, and I cannot stop the
> world from turning just because my consumer is not fast enough.
>

I'm still confused about your app. If your producer only uses put_nowait()
and never uses yield [from], the consumer will never run. So you must not
be describing the full story.

FWIW I'm fine with the proposal "from queue import Full as QueueFull, Empty
as QueueEmpty". We do a similar thing for the exceptions raised by futures
(CancelledError and TimeoutError are imported from concurrent.futures,
although without renaming).

-- 
--Guido van Rossum (python.org/~guido)

Reply via email to