Message225952
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. |
|
Date |
User |
Action |
Args |
2014-08-27 09:46:38 | cool-RR | set | recipients:
+ cool-RR, Claudiu.Popa, dan.oreilly |
2014-08-27 09:46:38 | cool-RR | set | messageid: <1409132798.67.0.501700242294.issue22281@psf.upfronthosting.co.za> |
2014-08-27 09:46:38 | cool-RR | link | issue22281 messages |
2014-08-27 09:46:38 | cool-RR | create | |
|