From 792a030c37ddad9cf5ec918e2f1c2c2ab049970b Mon Sep 17 00:00:00 2001 From: Rodrigo Almeida Date: Thu, 7 Oct 2021 16:58:02 +0200 Subject: [PATCH 1/4] MAX_THREADS to RIO_TILER_MAX_THREADS --- rio_tiler/constants.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rio_tiler/constants.py b/rio_tiler/constants.py index 24ae9314..c387004f 100644 --- a/rio_tiler/constants.py +++ b/rio_tiler/constants.py @@ -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) +) WEB_MERCATOR_CRS = CRS.from_epsg(3857) WGS84_CRS = CRS.from_epsg(4326) From c88ace80ffe6c577dd53856431c1e2dfa0f8f0ab Mon Sep 17 00:00:00 2001 From: Rodrigo Almeida Date: Fri, 8 Oct 2021 11:19:40 +0200 Subject: [PATCH 2/4] Update env variable in docs --- docs/mosaic.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/mosaic.md b/docs/mosaic.md index a3bff278..25a12776 100644 --- a/docs/mosaic.md +++ b/docs/mosaic.md @@ -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: From c9f4c55d21ffc66bf8a9b47a5b4f9493a6aa9a0e Mon Sep 17 00:00:00 2001 From: Rodrigo Almeida Date: Fri, 8 Oct 2021 11:26:18 +0200 Subject: [PATCH 3/4] Add to changelog --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index b35e0eec..021964dc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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` (https://github.com/cogeotiff/rio-tiler/pull/432) # 2.1.3 (2021-09-14) From 9792f7a8ac195b9ce62d14cc2eb88820ac2f7154 Mon Sep 17 00:00:00 2001 From: Vincent Sarago Date: Fri, 8 Oct 2021 11:28:30 +0200 Subject: [PATCH 4/4] Update CHANGES.md --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 021964dc..0fed32de 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,7 +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` (https://github.com/cogeotiff/rio-tiler/pull/432) +* 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)