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

@@ -133,6 +133,34 @@ class GPUStrategyTests(unittest.TestCase):
self.assertEqual(200, manager.state["acceptedTotal"])
self.assertEqual(0, manager.state["acceptedSinceRefresh"])
def test_refresh_prefers_classified_attributable_outcomes(self) -> None:
with tempfile.TemporaryDirectory() as temporary_dir:
path = Path(temporary_dir) / "strategy.json"
raw_history = make_history(
"gpu-a",
0,
200,
start=datetime(2026, 1, 1, tzinfo=timezone.utc),
)
classified_history = make_history(
"gpu-b",
200,
0,
start=datetime(2026, 1, 1, tzinfo=timezone.utc),
)
client = HistoryClient(raw_history)
manager = GPUStrategyManager(path, long_term_min_samples=100)
state = manager.prepare(
client,
supported_gpus=["gpu-a", "gpu-b", "gpu-c"],
history_records=classified_history,
)
self.assertEqual(0, client.list_calls)
self.assertEqual("classified_attributable_outcomes", state["historySource"])
self.assertEqual("gpu-b", state["longTermGpus"][0])
def test_market_weights_change_gpu_mix_without_changing_70_30_split(self) -> None:
supported = ["gpu-a", "gpu-b", "gpu-c", "gpu-d"]
manager = GPUStrategyManager("unused.json", market_intelligence=WeightedMarket())