From 6c749c93168a9a32d6aa70422d1e92119d2c9989 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 9 Jun 2023 03:06:20 -0400 Subject: [PATCH] More fixes to select_workload() More bugs from converting Machine's workload from a key to an integer --- OpenBench/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenBench/utils.py b/OpenBench/utils.py index e4e089f..633337b 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -550,13 +550,13 @@ def test_maps_onto_thread_count(test, threads, ncutechess, hyperthreads): def select_workload(machine, tests, variance=0.25): # Determine how many threads are assigned to each workload - table = { test.id : 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 table and m != machine: - table[m.workload] = table[m.workload] + m.info['concurrency'] + 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 @@ -565,7 +565,7 @@ def select_workload(machine, tests, variance=0.25): # 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]) / sum([x['throughput'] for x in table]) if min(ratios) / ideal_ratio > 1 - variance: return OpenBench.models.Test.objects(id=machine.workload)