Skip to content

Commit

Permalink
Merge pull request #2660 from camptocamp/index-error
Browse files Browse the repository at this point in the history
Don't store tiles in error
  • Loading branch information
sbrunner authored Dec 18, 2024
2 parents c4e3a7e + fbcbceb commit 6e8f43e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions tilecloud_chain/internal_mapcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,12 @@ def compute_tile(self, tile: Tile) -> bool:
if tile_.error:
_LOG.error("Tile %s %s in error: %s", tile_.tilecoord, tile_.formated_metadata, tile_.error)
success = False
if tile_.data is None:
elif tile_.data is None:
_LOG.error("Tile %s %s in error: no data", tile_.tilecoord, tile_.formated_metadata)
success = False
_LOG.debug("Tile %s %s generated", tile_.tilecoord, tile_.formated_metadata)
self._cache_store.put_one(tile_)
else:
_LOG.debug("Tile %s %s generated", tile_.tilecoord, tile_.formated_metadata)
self._cache_store.put_one(tile_)
return success

@contextlib.contextmanager
Expand Down
5 changes: 3 additions & 2 deletions tilecloud_chain/multitilestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,13 @@ def apply(key: tuple[str, str], tiles: Iterator[Tile]) -> Iterator[Tile]:

def __str__(self) -> str:
"""Return a string representation of the object."""
stores = {store.__class__.__name__ for store in self.stores.values() if store is not None}
stores = {str(store) for store in self.stores.values() if store is not None}
return f"{self.__class__.__name__}({', '.join(stores)})"

def __repr__(self) -> str:
"""Return a string representation of the object."""
return str(self)
stores = {repr(store) for store in self.stores.values() if store is not None}
return f"{self.__class__.__name__}({', '.join(stores)})"

@staticmethod
def _get_layer(tile: Tile | None) -> tuple[str, str]:
Expand Down
6 changes: 5 additions & 1 deletion tilecloud_chain/timedtilestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,8 @@ def get_cheap_bounding_pyramid(self) -> BoundingPyramid | None:

def __str__(self) -> str:
"""Get string representation."""
return f"tilecloud_chain.timedtilestore.TimedTileStoreWrapper: {self._tile_store}"
return f"{self.__class__.__name__}({self._tile_store}"

def __repr__(self) -> str:
"""Get string representation."""
return f"{self.__class__.__name__}({self._tile_store!r})"

0 comments on commit 6e8f43e

Please sign in to comment.