From b45caf403366ed4161516e49b9e433805d9de6c4 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 14 Jun 2024 01:12:19 -0700 Subject: [PATCH] LogReader: try zst on internal source (#32751) * internal source list files like azure api * messy but works * no limit * simpler * clean up * clean up * clean up * that's obvious * better * we need to unfortunately return a url, so best to take a naive approach for now * todo * fix * clean up --- tools/lib/logreader.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/lib/logreader.py b/tools/lib/logreader.py index e524a152fb308b..98c10941bb96a1 100755 --- a/tools/lib/logreader.py +++ b/tools/lib/logreader.py @@ -130,12 +130,12 @@ def valid_file(fn): return apply_strategy(mode, rlog_paths, qlog_paths, valid_file=valid_file) -def internal_source(sr: SegmentRange, mode: ReadMode) -> LogPaths: +def internal_source(sr: SegmentRange, mode: ReadMode, file_ext: str = "bz2") -> LogPaths: if not internal_source_available(): raise InternalUnavailableException def get_internal_url(sr: SegmentRange, seg, file): - return f"cd:/{sr.dongle_id}/{sr.log_id}/{seg}/{file}.bz2" + return f"cd:/{sr.dongle_id}/{sr.log_id}/{seg}/{file}.{file_ext}" rlog_paths = [get_internal_url(sr, seg, "rlog") for seg in sr.seg_idxs] qlog_paths = [get_internal_url(sr, seg, "qlog") for seg in sr.seg_idxs] @@ -143,6 +143,10 @@ def get_internal_url(sr: SegmentRange, seg, file): return apply_strategy(mode, rlog_paths, qlog_paths) +def internal_source_zst(sr: SegmentRange, mode: ReadMode, file_ext: str = "zst") -> LogPaths: + return internal_source(sr, mode, file_ext) + + def openpilotci_source(sr: SegmentRange, mode: ReadMode) -> LogPaths: rlog_paths = [get_url(sr.route_name, seg, "rlog") for seg in sr.seg_idxs] qlog_paths = [get_url(sr.route_name, seg, "qlog") for seg in sr.seg_idxs] @@ -175,7 +179,7 @@ def auto_source(sr: SegmentRange, mode=ReadMode.RLOG) -> LogPaths: if mode == ReadMode.SANITIZED: return comma_car_segments_source(sr, mode) - SOURCES: list[Source] = [internal_source, 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