Make the worker batch timeout configurable via LIDAR_BATCH_TIMEOUT

The pool of tile workers used to cancel every remaining tile after a
hardcoded 2-hour wall clock, silently truncating large batches (a
670-tile completion run lost its last 348 tiles that way). The timeout
now defaults to unlimited and can be capped per deployment with the
LIDAR_BATCH_TIMEOUT environment variable (seconds); the local worker
compose sets it to 6 hours.

💘 Generated with Crush

Assisted-by: Crush:glm-5.2
This commit is contained in:
Jacquin Antoine
2026-09-28 00:03:52 +02:00
parent 6e8580138c
commit d0dc8d90e9
4 changed files with 48 additions and 9 deletions

View File

@ -440,3 +440,21 @@ class TestResolveWorkers:
for _ in range(4): # 4th call: empty queue
pipeline._init_worker_slot(q)
assert calls == [("gpu", 1), ("cpu",)]
class TestBatchTimeout:
def test_env_var_parsing(self, monkeypatch):
"""LIDAR_BATCH_TIMEOUT: unset/0/invalid = unlimited, N seconds = N."""
from lidar_pipeline.pipeline import _batch_timeout_s
monkeypatch.delenv("LIDAR_BATCH_TIMEOUT", raising=False)
assert _batch_timeout_s() == 0.0
monkeypatch.setenv("LIDAR_BATCH_TIMEOUT", "")
assert _batch_timeout_s() == 0.0
monkeypatch.setenv("LIDAR_BATCH_TIMEOUT", "0")
assert _batch_timeout_s() == 0.0
monkeypatch.setenv("LIDAR_BATCH_TIMEOUT", "3600")
assert _batch_timeout_s() == 3600.0
monkeypatch.setenv("LIDAR_BATCH_TIMEOUT", "-5")
assert _batch_timeout_s() == 0.0
monkeypatch.setenv("LIDAR_BATCH_TIMEOUT", "abc")
assert _batch_timeout_s() == 0.0