From 0c7e1e0ba40ecacc5820730c79d1d03309e591f0 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Fri, 12 Dec 2025 10:42:33 -0800 Subject: [PATCH] Record part 1 even if part 2 panics --- aocsync.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/aocsync.py b/aocsync.py index e4be062..0a74a99 100755 --- a/aocsync.py +++ b/aocsync.py @@ -789,12 +789,14 @@ class CargoAOCRunner: f.write(f"{'='*80}\n\n") if result.returncode != 0: - logger.warning(f"cargo aoc bench failed for day {day} in {work_dir}: {result.stderr}") - continue + logger.warning(f"cargo aoc bench failed for day {day} in {work_dir} (return code: {result.returncode}). Will still attempt to parse any available timing data.") # Log output for debugging if no results found if not result.stdout.strip() and not result.stderr.strip(): logger.warning(f"No output from cargo aoc bench for {user} year {year} day {day}") + # Skip parsing if there's no output at all + if result.returncode != 0: + continue # Strip ANSI codes before parsing (for cleaner parsing) stdout_clean = CargoAOCRunner._strip_ansi_codes(result.stdout or "") @@ -804,15 +806,23 @@ class CargoAOCRunner: output_bytes = len(result.stdout.encode('utf-8')) if result.stdout else 0 # Parse output for runtime information + # Even if return code is non-zero (e.g., Part 2 panics), Part 1 timing might still be in output day_results = CargoAOCRunner._parse_runtime_output( stdout_clean, stderr_clean, day, year, user, git_rev, repo_url, output_bytes ) if day_results: logger.info(f"Parsed {len(day_results)} runtime result(s) for {user} year {year} day {day}") + if result.returncode != 0: + # Log which parts were successfully parsed despite the error + parts_parsed = [f"Part {r.part}" for r in day_results] + logger.info(f"Successfully parsed timing for {', '.join(parts_parsed)} despite non-zero return code") else: # Log a sample of the output to help debug parsing issues output_sample = (result.stdout + "\n" + result.stderr).strip()[:500] logger.warning(f"No runtime data parsed for {user} year {year} day {day}. Output sample: {output_sample}") + # Only skip if we got no results AND there was an error + if result.returncode != 0: + continue results.extend(day_results) except subprocess.TimeoutExpired: