feat: add governed nationwide AOI orchestration and CUDA enforcement
GeoIntel release gates / Compile, test, contracts and builds (push) Canceled after 0s
GeoIntel release gates / Python and npm vulnerability policy (push) Canceled after 0s
GeoIntel release gates / GIS image, SBOM and container scan (push) Canceled after 0s

This commit is contained in:
Jens
2026-07-26 05:23:33 +02:00
parent 25b6f1ab39
commit 2be72fac58
50 changed files with 1596 additions and 51 deletions
+28
View File
@@ -38,6 +38,8 @@ class YoloDetectionAdapter:
status_code=503,
)
self.validate_runtime()
try:
from ultralytics import YOLO
except ImportError as exc:
@@ -57,6 +59,32 @@ class YoloDetectionAdapter:
status_code=503,
) from exc
def validate_runtime(self) -> None:
if not self.settings.yolo_require_cuda:
return
try:
import torch
except Exception as exc:
raise AppError(
code="DETECTION_ACCELERATOR_UNAVAILABLE",
message="NVIDIA CUDA is required for configured YOLO inference, but PyTorch is not importable.",
status_code=503,
) from exc
if not torch.cuda.is_available():
raise AppError(
code="DETECTION_ACCELERATOR_UNAVAILABLE",
message="NVIDIA CUDA is required for configured YOLO inference, but no CUDA device is available.",
details={"configured_device": self.settings.yolo_device},
status_code=503,
)
if not str(self.settings.yolo_device).lower().startswith(("cuda", "0", "1", "2", "3")):
raise AppError(
code="DETECTION_ACCELERATOR_MISCONFIGURED",
message="NVIDIA CUDA is required, but YOLO_DEVICE does not select a CUDA device.",
details={"configured_device": self.settings.yolo_device},
status_code=503,
)
def predict_tile(self, model, tile_path: Path, confidence_threshold: float) -> list[dict[str, Any]]:
if not tile_path.exists() or not tile_path.is_file():
raise AppError(