Add wall-clock timeout to parallel worker pool

Prevents indefinite hang if a worker gets stuck (deadlocked PDAL,
I/O stall). 2-hour safety net for the entire batch; remaining
futures are cancelled on timeout.
This commit is contained in:
Antoine Jacquin
2026-09-07 21:20:19 +02:00
parent b9ab13c2d1
commit d27b92a26a

View File

@ -587,8 +587,14 @@ class LidarArchaeoPipeline:
for file_idx, laz_file in enumerate(files) for file_idx, laz_file in enumerate(files)
} }
done = 0 done = 0
t_deadline = time.time() + 7200
try: try:
for future in as_completed(future_to_file): for future in as_completed(future_to_file):
if time.time() > t_deadline:
logger.error("Délai dépassé (2h) — annulation des workers restants")
for f in future_to_file:
f.cancel()
break
laz_file = future_to_file[future] laz_file = future_to_file[future]
done += 1 done += 1
try: try: