From 03a3ade506224a9741c849bb7b475d61b7b48d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Wed, 18 Dec 2024 12:22:27 +0100 Subject: [PATCH 1/2] Add more log messages --- tilecloud_chain/internal_mapcache.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tilecloud_chain/internal_mapcache.py b/tilecloud_chain/internal_mapcache.py index e5a0b5cc4..001a114a2 100644 --- a/tilecloud_chain/internal_mapcache.py +++ b/tilecloud_chain/internal_mapcache.py @@ -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]: From 76709d7da0f7814d10f142a6f713010a360be258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Wed, 18 Dec 2024 12:44:02 +0100 Subject: [PATCH 2/2] Better MultiTileStore representation --- tilecloud_chain/multitilestore.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tilecloud_chain/multitilestore.py b/tilecloud_chain/multitilestore.py index fd87cf618..95988806e 100644 --- a/tilecloud_chain/multitilestore.py +++ b/tilecloud_chain/multitilestore.py @@ -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