Skip to content

Commit

Permalink
mosaic tile timeout (#33)
Browse files Browse the repository at this point in the history
* add MOSAIC_TILE_TIMEOUT configuration
* update jinja init
  • Loading branch information
Phil Varner authored May 29, 2024
1 parent 6decc7c commit 187d506
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## 0.14.0-1.0.5 (2024-05-29)

- Mosaic: Added MOSAIC_TILE_TIMEOUT to define maximum rendering time for a single tile.

## 0.14.0-1.0.4 (2023-10-04)

- Mosaic: For float-valued data (e.g., COP DEM), rescale before tiling.
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: GIS",
]
version="0.14.0"
Expand Down
8 changes: 4 additions & 4 deletions src/titiler/application/titiler/application/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
logging.getLogger("botocore.utils").disabled = True
logging.getLogger("rio-tiler").setLevel(logging.ERROR)

templates = Jinja2Templates(
directory="",
loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")]),
) # type:ignore
jinja2_env = jinja2.Environment(
loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")])
)
templates = Jinja2Templates(env=jinja2_env)


api_settings = ApiSettings()
Expand Down
9 changes: 4 additions & 5 deletions src/titiler/core/titiler/core/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@
from titiler.core.routing import EndpointScope
from titiler.core.utils import render_image

DEFAULT_TEMPLATES = Jinja2Templates(
directory="",
loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")]),
) # type:ignore

jinja2_env = jinja2.Environment(
loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")])
)
DEFAULT_TEMPLATES = Jinja2Templates(env=jinja2_env)

img_endpoint_params: Dict[str, Any] = {
"responses": {
Expand Down
8 changes: 4 additions & 4 deletions src/titiler/extensions/titiler/extensions/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

from titiler.core.factory import BaseTilerFactory, FactoryExtension

DEFAULT_TEMPLATES = Jinja2Templates(
directory="",
loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")]),
) # type:ignore
jinja2_env = jinja2.Environment(
loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")])
)
DEFAULT_TEMPLATES = Jinja2Templates(env=jinja2_env)


@dataclass
Expand Down
8 changes: 4 additions & 4 deletions src/titiler/extensions/titiler/extensions/wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
from titiler.core.resources.enums import ImageType, MediaType
from titiler.core.utils import render_image

DEFAULT_TEMPLATES = Jinja2Templates(
directory="",
loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")]),
) # type:ignore
jinja2_env = jinja2.Environment(
loader=jinja2.ChoiceLoader([jinja2.PackageLoader(__package__, "templates")])
)
DEFAULT_TEMPLATES = Jinja2Templates(env=jinja2_env)


class WMSMediaType(str, Enum):
Expand Down
2 changes: 1 addition & 1 deletion src/titiler/mosaic/titiler/mosaic/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ async def tile(
reader_params,
rescale,
),
30, # todo: ???
int(os.getenv("MOSAIC_TILE_TIMEOUT", 30)),
)
except asyncio.TimeoutError as e:
raise HTTPException(
Expand Down

1 comment on commit 187d506

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'TiTiler performance Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.

Benchmark suite Current: 187d506 Previous: 6decc7c Ratio
WebMercator longest_transaction 0.08 s 0.05 s 1.60

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.