Skip to content

Add terminate_workers to ProcessPoolExecutor #128041

Closed
@csm10495

Description

@csm10495

Feature or enhancement

Proposal:

This is an interpretation of the feature ask in: https://discuss.python.org/t/cancel-running-work-in-processpoolexecutor/58605/1. It would be a way to stop all the workers running in a ProcessPoolExecutor

p = ProcessPoolExecutor()
# use p

# i know i want p to die at this point no matter what
p.terminate_workers()

Previously the way to do this was to use to loop through the ._processes of the ProcessPoolExecutor though, preferably this should be possible without accessing implementation details.

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

https://discuss.python.org/t/cancel-running-work-in-processpoolexecutor/58605/1

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions