What to do when threads_per_worker is 0 #3986
Merged
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.
tl;dr Maybe
threads_per_worker
should throw an error if set to 0.While working on #3984 I ran into some odd behaviors when
threads_per_worker
is set to 0 inLocalCluster
. I am not sure what the intended behavior should be or if this PR makes things better.Some examples:
On master the following results in a divide by 0 error. This PR sets n_workers to 0 which I think is a good solution:
For the next case, I am not sure that the behavior should be. Here the
nthreads
is being passed int theworker_kwargs
as 0. So we don't really have control over what happens after that. In this case it sets nthreads for each worker toCPU_COUNT