Balance lifecycle shards using measured pedal caller cost

This commit is contained in:
Dom
2026-10-24 15:43:48 -05:00
parent a6779a8aa0
commit 44ad6f5342
3 changed files with 34 additions and 1 deletions
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "e03f35f018b7deeb9ccf3a53819fc489f66b22d0bec82343ad941bf56e835370", "schema_version": 1}
{"protected_inventory_sha256": "0fdb25f5deda7ee4e6ae2fd8afbff774c5c2260bc9dce6afa5dc0e95186b2aaf", "schema_version": 1}
+12
View File
@@ -735,6 +735,18 @@
"cases": 128,
"seconds": 5.208667722000996,
"source_sha256": "e5edc7933ea1a186c1b874deedbd2104a976c1d454241c58251a963b2b5953c0"
},
"openpilot/starpilot/car/toyota/tests/test_pedal_parent_callers.py": {
"cases": 92,
"seconds": 272.3922869809985,
"source_sha256": "ae85b8e373d4d12c302e59baad88ee88dda4221e3e1d255b294e2dbca9889acf",
"reference": {
"revision": "d43477ec413a31c445f264a65dbcc805117ef168",
"run_id": 40128755737,
"artifact_id": 12574163616,
"shard": 12,
"results_sha256": "3484585f40bb30a502adf638949ca5b251252365917d6f0d0c90db962f9ee3d5"
}
}
},
"reference": {
+21
View File
@@ -52,6 +52,27 @@ class LifecycleShardTests(unittest.TestCase):
if any(helper.matches(identity, target) for target in shard)]
self.assertCountEqual(selected, identities)
def test_measured_pedal_callers_keep_complete_module(self):
module = 'openpilot/starpilot/car/toyota/tests/test_pedal_parent_callers.py'
policy = helper.workload_policy()
measured = policy['modules'][module]
self.assertNotIn(module, policy['function_groups'])
self.assertEqual(measured['cases'], 92)
self.assertGreater(measured['seconds'], 100 * policy['unknown_seconds_per_case'])
self.assertEqual(len(measured['source_sha256']), 64)
self.assertEqual(measured['reference']['artifact_id'], 12574163616)
prefix = module.removesuffix('.py').replace('/', '.') + '.'
identities = [prefix + f'test_case[{index}]' for index in range(92)]
identities += [f'other.test_case[{index}]' for index in range(100)]
targets = [module, 'other.py']
shards = helper.partition(targets, identities, 2)
self.assertEqual(shards, [[module], ['other.py']])
self.assertCountEqual([target for shard in shards for target in shard], targets)
selected = [identity for shard in shards for identity in identities
if any(helper.matches(identity, target) for target in shard)]
self.assertCountEqual(selected, identities)
self.assertEqual(shards, helper.partition(list(reversed(targets)), list(reversed(identities)), 2))
def test_only_large_reviewed_heavy_functions_split_into_exact_parameter_leaves(self):
heavy = 'openpilot/starpilot/car/toyota/tests/test_legacy_advert_callers.py'
prefix = heavy.removesuffix('.py').replace('/', '.') + '.'