lidar-maps : navigation en cache seule et pyramide entretenue en tâche de fond

Sur une petite machine (Raspberry Pi), LIDAR_TILE_CACHE_ONLY sert les tuiles
depuis le cache uniquement (tuile absente = transparente non mémorisable,
X-Tile-Pending) et LIDAR_TILE_BACKGROUND fait surveiller les dalles par un
sondeur : chaque dalle nouvelle ou régénérée par le worker remet sa pyramide
en file, rendue à basse priorité et au ralenti. Scan et état pilotables via
/api/map/background, pré-calcul exhaustif toujours via /api/map/warm.
This commit is contained in:
Antoine Jacquin
2026-09-23 19:05:58 +02:00
parent 053eb2f529
commit 900332cdbc
5 changed files with 416 additions and 10 deletions

View File

@ -487,3 +487,20 @@ def test_remote_index_failure_keeps_local(tmp_path, monkeypatch):
monkeypatch.setattr(tiles, "_remote_payload", lambda force=False: None)
layers = tiles.source_index(tmp_path, force=True)
assert set(layers) == {"slope"}
def test_cached_tile_states(tmp_path):
"""`cached_tile` : lecture cache seule — fresh / pending / empty, sans rendu."""
from lidar_pipeline import tiles
_make_dalle(tmp_path, 1054, 6882, ["slope"])
x, y = _tile_of_cell(1054, 6882, 14)
data, state = tiles.cached_tile(tmp_path, "slope", 14, x, y)
assert state == "pending" and data is None
assert not tiles.tile_cache_path(tmp_path, "slope", 14, x, y).exists()
tiles.get_tile(tmp_path, "slope", 14, x, y) # rendu (maintenance, warm…)
data, state = tiles.cached_tile(tmp_path, "slope", 14, x, y)
assert state == "fresh" and data
# Hors données : état empty + marqueur posé, toujours sans rendu
data, state = tiles.cached_tile(tmp_path, "slope", 14, 0, 0)
assert state == "empty" and data is None
assert tiles.empty_marker_exists(tmp_path, "slope", 14, 0, 0)