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

Use RIO_TILER_MAX_THREADS instead of MAX_THREADS #432

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* remove python 3.6 support (https://github.com/cogeotiff/rio-tiler/pull/418)
* remove `max_size` defaults for `COGReader.part` and `COGReader.feature`, which will now default to full resolution reading.
* Deprecate `.metadata` methods (https://github.com/cogeotiff/rio-tiler/pull/423)
* Use `RIO_TILER_MAX_THREADS` environment variable instead of `MAX_THREADS` (author @rodrigoalmeida94, https://github.com/cogeotiff/rio-tiler/pull/432)

# 2.1.3 (2021-09-14)

Expand Down
2 changes: 1 addition & 1 deletion docs/mosaic.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ By default the chunck_size is equal to the number or threads (or the number of a

#### More on threading

The number of threads used can be set in the function call with the `threads=` options. By default it will be equal to `multiprocessing.cpu_count() * 5` or to the `MAX_THREADS` environment variable.
The number of threads used can be set in the function call with the `threads=` options. By default it will be equal to `multiprocessing.cpu_count() * 5` or to the `RIO_TILER_MAX_THREADS` environment variable.
In some case, threading can slow down your application. You can set threads to `0` or `1` to run the tiler in a loop without using a ThreadPool (ref: [#207](https://github.com/cogeotiff/rio-tiler/issues/207)).

Benchmark:
Expand Down
4 changes: 3 additions & 1 deletion rio_tiler/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
NoData = Union[float, int, str]
Indexes = Union[Sequence[int], int]

MAX_THREADS = int(os.environ.get("MAX_THREADS", multiprocessing.cpu_count() * 5))
MAX_THREADS = int(
os.environ.get("RIO_TILER_MAX_THREADS", multiprocessing.cpu_count() * 5)
)
rodrigoalmeida94 marked this conversation as resolved.
Show resolved Hide resolved

WEB_MERCATOR_CRS = CRS.from_epsg(3857)
WGS84_CRS = CRS.from_epsg(4326)
Expand Down