Skip to content

Commit

Permalink
Merge pull request #2656 from camptocamp/index-error
Browse files Browse the repository at this point in the history
Add more log messages
  • Loading branch information
sbrunner authored Dec 18, 2024
2 parents 053f3c9 + b725191 commit 77f2bb4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tilecloud_chain/internal_mapcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,17 @@ 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)
return False
success = True
for tile_ in tile.metadata["tiles"].values(): # type: ignore
if tile_.error:
_LOG.error("Tile %s %s in error: %s", tile_.tilecoord, tile_.formated_metadata, tile_.error)
return False
success = False
if tile_.data is None:
_LOG.error("Tile %s %s in error: no data", tile_.tilecoord, tile_.formated_metadata)
return False
success = False
_LOG.debug("Tile %s %s generated", tile_.tilecoord, tile_.formated_metadata)
self._cache_store.put_one(tile_)
return True
return success

@contextlib.contextmanager
def lock(self, tile: Tile) -> Iterator[None]:
Expand Down
9 changes: 9 additions & 0 deletions tilecloud_chain/multitilestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ def apply(key: tuple[str, str], tiles: Iterator[Tile]) -> Iterator[Tile]:

return chain.from_iterable(starmap(apply, groupby(tiles, self._get_layer)))

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}
return f"{self.__class__.__name__}({', '.join(stores)})"

def __repr__(self) -> str:
"""Return a string representation of the object."""
return str(self)

@staticmethod
def _get_layer(tile: Tile | None) -> tuple[str, str]:
assert tile is not None
Expand Down

0 comments on commit 77f2bb4

Please sign in to comment.