feat: make model age admission-only

This commit is contained in:
CoolBoy
2026-08-12 10:18:09 +08:00
parent 86088ce577
commit 91d1d3d87d
15 changed files with 438 additions and 653 deletions

View File

@@ -17,7 +17,7 @@ DEFAULT_GPU_STRATEGY_PATH = Path(".modelhub_state/gpu_strategy.json")
DEFAULT_REFRESH_SUBMISSIONS = 200
DEFAULT_RECENT_TERMINAL_WINDOW = 1000
DEFAULT_LONG_TERM_MIN_SAMPLES = 100
STRATEGY_STATE_VERSION = 3
STRATEGY_STATE_VERSION = 4
LONG_TERM = "long_term"
RECENT = "recent"
@@ -291,6 +291,7 @@ class GPUStrategyManager:
*,
supported_gpus: list[str],
now: datetime | None = None,
history_records: list[dict[str, Any]] | None = None,
) -> dict[str, Any]:
now = now or utc_now()
supported_gpus = list(dict.fromkeys(gpu for gpu in supported_gpus if gpu))
@@ -304,7 +305,11 @@ class GPUStrategyManager:
previous_generation = int(state.get("generation", -1)) if state is not None else -1
self.log(f"[strategy] refresh_start reason={reason} supported_gpus={len(supported_gpus)}")
try:
tasks = self._load_platform_history(client)
tasks = (
list(history_records)
if history_records is not None
else self._load_platform_history(client)
)
refreshed = build_strategy_snapshot(
tasks,
supported_gpus=supported_gpus,
@@ -315,6 +320,11 @@ class GPUStrategyManager:
refresh_submissions=self.refresh_submissions,
)
refreshed["acceptedTotal"] = int((state or {}).get("acceptedTotal") or 0)
refreshed["historySource"] = (
"classified_attributable_outcomes"
if history_records is not None
else "raw_platform_history"
)
self.state = refreshed
write_json(self.path, refreshed)
self._log_state("refreshed")