LocalExecutor: add configurable worker reuse and match Executor API#52
Closed
tfpgh wants to merge 1 commit into
Closed
LocalExecutor: add configurable worker reuse and match Executor API#52tfpgh wants to merge 1 commit into
tfpgh wants to merge 1 commit into
Conversation
Contributor
|
LocalExecutor was never really intended to be fast or used outside of some specific test use cases. if you want to replace a distributed executor somewhere, just use process pool? If for any reason that isn’t an easy or good swap, let me know. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LocalExecutorhardcodesmax_tasks_per_child=1to match the isolation of the distributedExecutor. This launches a fresh process for each task. If tasks are cheap, spawning a new interpreter and re-importing everything can cost many times the task itself.Separately,
Executorreplaces itself on instantiation withLocalExecutorwhenforce_local=True. ButLocalExecutordoesn't implementget_submit_queue_size()fromExecutor's interface, meaning any caller using it crashes with anAttributeErrorin local mode.JobConfig.local_max_tasks_per_child: Optional[int] = 1, passed through to theProcessPoolExecutorin local mode.LocalExecutorusers can elect to run multiple tasks per launched process. This leaves the default behavior unchanged.LocalExecutor.get_submit_queue_size(), making local mode closer to a drop-in swap.