Skip to content
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

Allow re-using the ThreadPoolExecutor across epochs. #272

Open
mthrok opened this issue Nov 12, 2024 · 1 comment
Open

Allow re-using the ThreadPoolExecutor across epochs. #272

mthrok opened this issue Nov 12, 2024 · 1 comment

Comments

@mthrok
Copy link
Collaborator

mthrok commented Nov 12, 2024

No description provided.

@mthrok
Copy link
Collaborator Author

mthrok commented Nov 25, 2024

Update: This turned out to be trickier than I thought. EventLoop shutdown the default thread pool at the end, so either we need to keep the event loop or wrap the executor to make the shutdown request from the event loop no-op.

However, in both cases, we need to think about the cases where the iteration is interrupted in the middle. When there are work items in the queue of ThreadPoolExecutor, and the foreground loop is interrupted, what to do with items in queue?

This corresponds to cancel_future of shutdown method.

https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.shutdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant