bpo-22281 ENH add introspection API for concurrent.futures Executor#4243
bpo-22281 ENH add introspection API for concurrent.futures Executor#4243tomMoral wants to merge 4 commits intopython:mainfrom
Conversation
|
As I said in the original issue, I think this should be a single
Of course, the returned dictionary would be something like: I'd also see something like a |
|
By the way, you should probably base your work on PR #4241 because I'm soon gonna merge it :-) |
d9768bc to
3a56a69
Compare
|
I just rebased the PR and I will implement the |
|
Woops... It looks like squashing PR #4241 on push left this PR with conflicts. I'm sorry :-/ |
ce0687d to
4887735
Compare
|
Yes I will rebase it and see what needs to be improved. |
029af66 to
b8a36d5
Compare
|
@pitrou I think this PR implements a basic API for the introspection. Now it is a matter of what should we add in it. You mentioned the addition of a We could easily add timing for the different states of the futures. This would allow to gain info on the average waiting time/running time in the executor but I am not sure how interesting it is. |
8468205 to
93066a7
Compare
- Use a ExecutorFlags object for more consistent status - Improve the shutdown of the ProcessPoolExecutor
93066a7 to
bd49fa0
Compare
|
@tomMoral I think we don't need to add more statistics for now. OTOH the implementation is more complicated than I expected. Is |
|
@pitrou My first take was to implement the And sorry for the long delay, I just got back from vacations. |
|
Is there still interest in this change? It looks like there have been other changes merged since this was created. Thanks! |
|
This PR is stale because it has been open for 30 days with no activity. |
|
The following commit authors need to sign the Contributor License Agreement: |
|
This PR is stale because it has been open for 30 days with no activity. |
This PR is building from the patch coming from the orignal issue (https://bugs.python.org/issue22281) [GH-66477] to add an introspection API for the
concurrent.futuresexecutors. The following methods are added:worker_count(): Total number of workers currently in the poolactive_worker_count(): Number of workers currently processing a work itemidle_worker_count(): Number of workers not processing a work itemtask_count(): Total number of tasks currently being handled by the poolactive_task_count(): Number of tasks currently being processed by workerswaiting_task_count(): Number of submitted tasks not yet being processed by a workeractive_tasks(): A set of _WorkItem objects currently being processed by a worker.waiting_tasks(): A list of_WorkItemobjects currently waiting to be processed by a worker.The discussion in the orignal issue proposed to use properties instead of methods and to add a couple functionalities. I am up for inputs on that. I think a nice addition would be some indication of the work load in the
Executor, by timing the idle time and active time of each tasks and collecting it.https://bugs.python.org/issue22281