Merge branch 'development' into multiple_repos

This commit is contained in:
andrew committed 2023-06-09 11:04:22 -04:00
commit 07cee5168b
2 files changed
+8 -11

No files matched your search

+1 -1
View File
@@ -141,7 +141,7 @@ class Test(Model):
updated = DateTimeField(auto_now=True)
def __str__(self):
return '{0} vs {1} @ {2}'.format(self.dev.name, self.base.name, self.dev_timecontrol)
return '{0} vs {1} @ {2}'.format(self.dev.name, self.base.name, self.dev_time_control)
class LogEvent(Model):
+7 -10
View File
@@ -549,28 +549,25 @@ def test_maps_onto_thread_count(test, threads, ncutechess, hyperthreads):
def select_workload(machine, tests, variance=0.25):
# For reference for later
test_ids = [test.id for test in tests]
# Determine how many threads are assigned to each workload
table = { test : 0 for test in tests }
table = { test.id : { 'cores' : 0, 'throughput' : test.throughput } for test in tests }
for m in getRecentMachines():
if m.workload in test_ids and m != machine:
table[m.workload] = table[m.workload] + m.info['concurrency']
if m.workload in table and m != machine:
table[m.workload]['cores'] += m.info['concurrency']
# Find the tests most deserving of resources currently
ratios = [table[test] / test.throughput for test in tests]
ratios = [table[x]['cores'] / table[x]['throughput'] for x in table]
lowest_idxs = [i for i, r in enumerate(ratios) if r == min(ratios)]
# Machine is out of date; or there is an unassigned test
if machine.workload not in test_ids or min(ratios) == 0:
if machine.workload not in table or min(ratios) == 0:
return tests[random.choice(lowest_idxs)]
# No test has less than (1-variance)% of its deserved resources, and
# therefore we may have this machine repeat its existing workload again
ideal_ratio = sum(table.values()) / sum([x.throughput for x in tests])
ideal_ratio = sum([x['cores'] for x in table.values()]) / sum([x['throughput'] for x in table.values()])
if min(ratios) / ideal_ratio > 1 - variance:
return OpenBench.models.Test.objects(id=machine.workload)
return OpenBench.models.Test.objects.get(id=machine.workload)
# Fallback to simply doing the least attention given test
return tests[random.choice(lowest_idxs)]