ci: show partition fit window as a date range in the step summary (#27457)
This commit is contained in:
@@ -167,7 +167,8 @@ def main():
|
|||||||
print(f"Fetching {args.model_url}", file=sys.stderr)
|
print(f"Fetching {args.model_url}", file=sys.stderr)
|
||||||
model = fetch_model(args.model_url)
|
model = fetch_model(args.model_url)
|
||||||
print(
|
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_runs={model.get('n_runs')} "
|
||||||
f"n_suites={len(model.get('est', {}))}",
|
f"n_suites={len(model.get('est', {}))}",
|
||||||
file=sys.stderr,
|
file=sys.stderr,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import json
|
|||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import yaml # PyYAML; preinstalled on ubuntu-latest GHA runners.
|
import yaml # PyYAML; preinstalled on ubuntu-latest GHA runners.
|
||||||
|
|
||||||
@@ -179,6 +180,21 @@ def compute_partitions(
|
|||||||
return result
|
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():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
parser.add_argument("--repo-root", default=REPO_ROOT)
|
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)"
|
src_note = "no live model -- static est_time + (coeff=1, bias=0)"
|
||||||
else:
|
else:
|
||||||
src_note = (
|
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"`n_runs={partition_model.get('n_runs')}`"
|
||||||
)
|
)
|
||||||
f.write(
|
f.write(
|
||||||
|
|||||||
Reference in New Issue
Block a user