feat(testing): add max_frames parameter to E2EHarness

Caps the iteration length (and the matching GT slice) when set, so CI
tiers can stay fast on multi-thousand-frame sequences like EuRoC MH_01
(3682 frames ≈ 3+ hours at 3-5s/frame). Also useful for eyeballing a
new adapter's first N frames before committing to a full run.

Three new harness tests cover truncation, explicit None, and over-large
limits. No change to existing adapters or downstream tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yuzviak
2026-04-17 17:42:38 +03:00
committed by Maksym Yuzviak
parent 5128ac17ba
commit fd54af2d9f
2 changed files with 48 additions and 2 deletions
+19 -2
View File
@@ -45,11 +45,24 @@ class HarnessResult:
class E2EHarness:
"""Drives FlightProcessor from a DatasetAdapter; collects results."""
"""Drives FlightProcessor from a DatasetAdapter; collects results.
def __init__(self, adapter: DatasetAdapter, flight_id: str = "e2e-flight") -> None:
`max_frames` caps the iteration (and the matching GT slice). Useful for:
- CI tiers where a full multi-thousand-frame sequence is too slow.
- Debugging a new adapter — eyeball the first N frames before committing
to a multi-hour run.
`None` (default) means "consume the full dataset".
"""
def __init__(
self,
adapter: DatasetAdapter,
flight_id: str = "e2e-flight",
max_frames: Optional[int] = None,
) -> None:
self._adapter = adapter
self._flight_id = flight_id
self._max_frames = max_frames
self._estimates: list[tuple[int, Optional[tuple[float, float, float]]]] = []
async def run(self) -> HarnessResult:
@@ -57,6 +70,10 @@ class E2EHarness:
frames = list(self._adapter.iter_frames())
gt_poses = list(self._adapter.iter_ground_truth())
if self._max_frames is not None:
frames = frames[: self._max_frames]
gt_poses = gt_poses[: self._max_frames]
for frame in frames:
image = self._load_or_synth_image(frame.image_path)
result = await processor.process_frame(