diff --git a/scripts/ci/update_est_time.py b/scripts/ci/update_est_time.py index de9b9bd40..cce4b6353 100755 --- a/scripts/ci/update_est_time.py +++ b/scripts/ci/update_est_time.py @@ -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, diff --git a/scripts/ci/utils/compute_partitions.py b/scripts/ci/utils/compute_partitions.py index d1f52ce49..56d035ebe 100644 --- a/scripts/ci/utils/compute_partitions.py +++ b/scripts/ci/utils/compute_partitions.py @@ -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(