From 835ea3fa5a3337a11d9c336cdcdefa538adc0eed Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 26 Jul 2024 00:05:00 -0700 Subject: [PATCH] damn, actually we don't need all this (cool tho) Revert "regen: specify any list of sources" This reverts commit ceb0b4abed9ad463a9fe98d9b98a05875a52806f. --- selfdrive/test/process_replay/regen.py | 5 ++--- tools/lib/logreader.py | 11 +++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/selfdrive/test/process_replay/regen.py b/selfdrive/test/process_replay/regen.py index 17a9ebc34e..00f2fb109a 100755 --- a/selfdrive/test/process_replay/regen.py +++ b/selfdrive/test/process_replay/regen.py @@ -6,7 +6,6 @@ import capnp import numpy as np from typing import Any -from functools import partial from collections.abc import Iterable from openpilot.selfdrive.test.process_replay.process_replay import CONFIGS, FAKEDATA, ProcessConfig, replay_process, get_process_config, \ @@ -15,7 +14,7 @@ from openpilot.selfdrive.test.process_replay.vision_meta import DRIVER_CAMERA_FR from openpilot.selfdrive.test.update_ci_routes import upload_route from openpilot.tools.lib.route import Route from openpilot.tools.lib.framereader import FrameReader, BaseFrameReader, FrameType -from openpilot.tools.lib.logreader import LogReader, LogIterable, auto_source, internal_source, internal_source_zst +from openpilot.tools.lib.logreader import LogReader, LogIterable from openpilot.tools.lib.helpers import save_log @@ -76,7 +75,7 @@ def setup_data_readers( assert device_type != "neo", "Driver camera not supported on neo segments. Use dummy dcamera." frs['driverCameraState'] = FrameReader(r.dcamera_paths()[sidx]) else: - lr = LogReader(f"{route}/{sidx}/r", default_source=partial(auto_source, sources=[internal_source, internal_source_zst])) + lr = LogReader(f"cd:/{route.replace('|', '/')}/{sidx}/rlog.bz2") frs = {} if needs_road_cam: frs['roadCameraState'] = FrameReader(f"cd:/{route.replace('|', '/')}/{sidx}/fcamera.hevc") diff --git a/tools/lib/logreader.py b/tools/lib/logreader.py index ed2351dc11..07a4b2003e 100755 --- a/tools/lib/logreader.py +++ b/tools/lib/logreader.py @@ -179,24 +179,23 @@ def check_source(source: Source, *args) -> LogPaths: return files -def auto_source(sr: SegmentRange, mode=ReadMode.RLOG, sources: list[Source] = None) -> LogPaths: +def auto_source(sr: SegmentRange, mode=ReadMode.RLOG) -> LogPaths: if mode == ReadMode.SANITIZED: return comma_car_segments_source(sr, mode) - if sources is None: - sources: list[Source] = [internal_source, internal_source_zst, openpilotci_source, comma_api_source, comma_car_segments_source,] + SOURCES: list[Source] = [internal_source, internal_source_zst, openpilotci_source, comma_api_source, comma_car_segments_source,] exceptions = {} # for automatic fallback modes, auto_source needs to first check if rlogs exist for any source if mode in [ReadMode.AUTO, ReadMode.AUTO_INTERACTIVE]: - for source in sources: + for source in SOURCES: try: return check_source(source, sr, ReadMode.RLOG) except Exception: pass # Automatically determine viable source - for source in sources: + for source in SOURCES: try: return check_source(source, sr, mode) except Exception as e: @@ -261,7 +260,7 @@ are uploaded or auto fallback to qlogs with '/a' selector at the end of the rout def __init__(self, identifier: str | list[str], default_mode: ReadMode = ReadMode.RLOG, default_source=auto_source, sort_by_time=False, only_union_types=False): self.default_mode = default_mode - self.default_source = default_source # TODO: `default_source` name is confusing? should be `source` and should not be able to be overridden + self.default_source = default_source self.identifier = identifier self.sort_by_time = sort_by_time