Harden summary_metrics parsing for None rows
This commit is contained in:
@@ -16,14 +16,19 @@ def parse_last_row(history_path: Path):
|
|||||||
rows = history_path.read_text(encoding="utf-8").strip().splitlines()
|
rows = history_path.read_text(encoding="utf-8").strip().splitlines()
|
||||||
if len(rows) < 2:
|
if len(rows) < 2:
|
||||||
return None
|
return None
|
||||||
last = rows[-1].split(",")
|
for line in reversed(rows[1:]):
|
||||||
if len(last) < 4:
|
parts = line.split(",")
|
||||||
return None
|
if len(parts) < 4:
|
||||||
|
continue
|
||||||
|
try:
|
||||||
return {
|
return {
|
||||||
"avg_ks": float(last[1]),
|
"avg_ks": float(parts[1]),
|
||||||
"avg_jsd": float(last[2]),
|
"avg_jsd": float(parts[2]),
|
||||||
"avg_lag1_diff": float(last[3]),
|
"avg_lag1_diff": float(parts[3]),
|
||||||
}
|
}
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Reference in New Issue
Block a user