Ram Rachum added the comment:

I'd definitely consolidate.

First of all, I'd put a few useful numbers in `Executor.__repr__`. Something 
like <ThreadPoolExecutor(7), 3 workers busy, 0 work items queued>. That already 
makes to easy to get a general picture of how the executor is doing without 
digging in too deeply.

Next, I'd make a property `workers` (or if you want to make it a method, that's 
okay). It'll return a list of all the workers, and in their `__repr__` they'll 
have the work item that they're working on. Maybe we could also add 
`idle_workers` and `busy_workers`, then people can call `len` on them. (No 
point in making a function that tells their length if it doesn't expose them 
directly.) Also "active" may not be a clear term, I think that "busy" 
communicates it better, and is shorter to boot.

I'd also add `queued_work_items` and `active_work_items`, and I think that 
takes care of everything.

----------
nosy: +cool-RR

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22281>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to