Record part 1 even if part 2 panics

This commit is contained in:
Bill Thiede 2025-12-12 10:42:33 -08:00
parent 3b8db3e80f
commit 0c7e1e0ba4

View File

@ -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: