Skip to content

Commit

Permalink
Try using blockcache
Browse files Browse the repository at this point in the history
  • Loading branch information
abarciauskas-bgse committed Nov 7, 2023
1 parent cb81889 commit ee2d32f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions titiler/xarray/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def tiles_endpoint( # type: ignore
x, y, z, tilesize=scale * 256, nodata=src_dst.input.rio.nodata
)


if post_process:
image = post_process(image)

Expand Down
2 changes: 0 additions & 2 deletions titiler/xarray/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import logging
import os
import shutil
import sys
sys.path.appned('/mnt/efs/libraries')

import rioxarray
import zarr
Expand Down
11 changes: 7 additions & 4 deletions titiler/xarray/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ def get_cache_args(protocol: str) -> Dict[str, Any]:
"""
Get the cache arguments for the given protocol.
"""
if protocol == "s3":
directory = f"{api_settings.fsspec_cache_directory}/blockcache"
else:
directory = f"{api_settings.fsspec_cache_directory}/filecache"

return {
"target_protocol": protocol,
"cache_storage": api_settings.fsspec_cache_directory,
"cache_storage": directory,
"remote_options": {"anon": True},
}

Expand Down Expand Up @@ -70,7 +75,7 @@ def get_filesystem(
"""
if protocol == "s3":
s3_filesystem = (
fsspec.filesystem("filecache", **get_cache_args(protocol))
fsspec.filesystem("blockcache", **get_cache_args(protocol))
if enable_fsspec_cache
else s3fs.S3FileSystem()
)
Expand Down Expand Up @@ -132,8 +137,6 @@ def xarray_open_dataset(
"decode_coords": "all",
"decode_times": decode_times,
"engine": xr_engine,
"cache": False,
"chunks": {}, # loads the dataset with dask using engine preferred chunks if exposed by the backend
}

# Argument if we're opening a datatree
Expand Down

0 comments on commit ee2d32f

Please sign in to comment.