-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: Allow users to configure the internal thread pool (#11) #54
Changes from 1 commit
7de6eb7
2d464f2
d445578
4231270
e643352
4cd311d
ec80d19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Branch 'configurable-thread-pool' set up to track remote branch 'main' from 'origin'. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -634,7 +634,7 @@ def reduce_bands(x, acc): | |
return target_image | ||
|
||
def _raw_indexing_method( | ||
self, key: tuple[Union[int, slice], ...] | ||
self, key: tuple[Union[int, slice], ...], executor_kwargs: Optional[dict] = None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This extra argument is named well, but I think it should be set in the constructor. |
||
) -> np.typing.ArrayLike: | ||
key, squeeze_axes = self._key_to_slices(key) | ||
|
||
|
@@ -682,8 +682,11 @@ def _raw_indexing_method( | |
for _ in range(shape[0]) | ||
] | ||
|
||
# TODO(#11): Allow users to configure this via kwargs. | ||
with concurrent.futures.ThreadPoolExecutor() as pool: | ||
# If executor_kwargs is None, use an empty dictionary | ||
if executor_kwargs is None: | ||
executor_kwargs = {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's do this bit of logic in the constructor, too. |
||
# Pass executor_kwargs to ThreadPoolExecutor | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment is a bit too verbose for my taste. |
||
with concurrent.futures.ThreadPoolExecutor(**executor_kwargs) as pool: | ||
for (i, j, k), arr in pool.map( | ||
self._make_tile, self._tile_indexes(key[0], bbox) | ||
): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this file.