[issue29603] More informative Queue class: new method that returns number of unfinished tasks

slytomcat report at bugs.python.org
Wed Feb 22 12:51:41 EST 2017


slytomcat added the comment:

I can't fully agree with this:
>Queue objects are primarily about managing a queue of inputs.  
>Monitoring and managing consumers is another (mostly orthogonal) realm.

Monitoring of consumers is already added via task_done() and join() methods. At least this two methods allows to understand that all consumers are in idle state.
The unfinished() - is just functional extension to this existing functionality.

>For other users, the new method is problematic because it is distracting
>and prone to misuse (potentially out-of-date upon return and potentially 
>meaningless if task_done isn't being used).  I believe the new method 
>will cause more problems than it fixes.

This sounds reasonable because I also understand that this method is not usable in all cases as in most cases task_done is not used.

Probably my idea for method unfinished is really not so good...

Actually I've manage to find unpublished Queue.unfinished_tasks variable just in several minutes when I tried to find solution for threaded PoolExecutor. Hope that any curious developer can find it too.

I don't mind if you close this CR. 

Thanks for pleasant discussion.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29603>
_______________________________________


More information about the Python-bugs-list mailing list