ci: show partition fit window as a date range in the step summary (#27457)

This commit is contained in:
Liangsheng Yin
2026-06-06 14:39:36 -07:00
committed by GitHub
parent 9097647090
commit 4989d6691d
2 changed files with 19 additions and 2 deletions
+2 -1
View File
@@ -167,7 +167,8 @@ def main():
print(f"Fetching {args.model_url}", file=sys.stderr)
model = fetch_model(args.model_url)
print(
f" model data_as_of={model.get('data_as_of')} "
f" model fit_window_start={model.get('fit_window_start')} "
f"fit_window_days={model.get('fit_window_days')} "
f"n_runs={model.get('n_runs')} "
f"n_suites={len(model.get('est', {}))}",
file=sys.stderr,
+17 -1
View File
@@ -12,6 +12,7 @@ import json
import math
import os
from collections import defaultdict
from datetime import datetime, timedelta
import yaml # PyYAML; preinstalled on ubuntu-latest GHA runners.
@@ -179,6 +180,21 @@ def compute_partitions(
return result
def format_fit_window(model: dict) -> str:
"""Render the model's fit window as `[start, end)` for the step summary.
Surfacing the whole span keeps the lower-bound date from reading as a
staleness marker (it trails today by fit_window_days)."""
start = model.get("fit_window_start")
days = model.get("fit_window_days")
if not start or not isinstance(days, int):
return f"fit_window_start={start}"
end = (datetime.strptime(start[:10], "%Y-%m-%d") + timedelta(days=days)).strftime(
"%Y-%m-%d"
)
return f"fit over [{start[:10]}, {end}) ({days}d window)"
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--repo-root", default=REPO_ROOT)
@@ -234,7 +250,7 @@ def main():
src_note = "no live model -- static est_time + (coeff=1, bias=0)"
else:
src_note = (
f"live model `data_as_of={partition_model.get('data_as_of')}`, "
f"live model: {format_fit_window(partition_model)}, "
f"`n_runs={partition_model.get('n_runs')}`"
)
f.write(