-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-22281 ENH add introspection API for concurrent.futures Executor #4243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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) to add an introspection API for the
concurrent.futures
executors. 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_WorkItem
objects 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