From 0768330e96974a42616d229d159780619d049cd0 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 26 Jul 2024 00:04:50 -0700 Subject: [PATCH] regen and process replay --- selfdrive/test/process_replay/ref_commit | 2 +- selfdrive/test/process_replay/regen.py | 2 +- selfdrive/test/process_replay/test_processes.py | 4 ++-- tools/lib/helpers.py | 5 ++++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index 02e4b997aa..0f7e9f3b54 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -3942de8e75caa7a99828e65c3396abd94d6b3da7 +ceb0b4abed9ad463a9fe98d9b98a05875a52806f \ No newline at end of file diff --git a/selfdrive/test/process_replay/regen.py b/selfdrive/test/process_replay/regen.py index 6f8944eea9..17a9ebc34e 100755 --- a/selfdrive/test/process_replay/regen.py +++ b/selfdrive/test/process_replay/regen.py @@ -120,7 +120,7 @@ def regen_and_save( log_dir = os.path.join(outdir, time.strftime("%Y-%m-%d--%H-%M-%S--0", time.gmtime())) rel_log_dir = os.path.relpath(log_dir) - rpath = os.path.join(log_dir, "rlog.bz2") + rpath = os.path.join(log_dir, "rlog.zst") os.makedirs(log_dir) save_log(rpath, output_logs, compress=True) diff --git a/selfdrive/test/process_replay/test_processes.py b/selfdrive/test/process_replay/test_processes.py index 533ab125f9..b1e41082ee 100755 --- a/selfdrive/test/process_replay/test_processes.py +++ b/selfdrive/test/process_replay/test_processes.py @@ -198,11 +198,11 @@ if __name__ == "__main__": if cfg.proc_name not in tested_procs: continue - cur_log_fn = os.path.join(FAKEDATA, f"{segment}_{cfg.proc_name}_{cur_commit}.bz2") + cur_log_fn = os.path.join(FAKEDATA, f"{segment}_{cfg.proc_name}_{cur_commit}.zst") if args.update_refs: # reference logs will not exist if routes were just regenerated ref_log_path = get_url(*segment.rsplit("--", 1)) else: - ref_log_fn = os.path.join(FAKEDATA, f"{segment}_{cfg.proc_name}_{ref_commit}.bz2") + ref_log_fn = os.path.join(FAKEDATA, f"{segment}_{cfg.proc_name}_{ref_commit}.zst") ref_log_path = ref_log_fn if os.path.exists(ref_log_fn) else BASE_URL + os.path.basename(ref_log_fn) dat = None if args.upload_only else log_data[segment] diff --git a/tools/lib/helpers.py b/tools/lib/helpers.py index e9b4b85e70..29ce2eb8eb 100644 --- a/tools/lib/helpers.py +++ b/tools/lib/helpers.py @@ -1,4 +1,5 @@ import bz2 +import zstd # regex patterns @@ -23,8 +24,10 @@ class RE: def save_log(dest, log_msgs, compress=True): dat = b"".join(msg.as_builder().to_bytes() for msg in log_msgs) - if compress: + if compress and dest.endswith(".bz2"): dat = bz2.compress(dat) + elif compress and dest.endswith(".zst"): + dat = zstd.compress(dat, 10) with open(dest, "wb") as f: f.write(dat)