From f35961e0545e024bbd66e2caee28192e5d7f264e Mon Sep 17 00:00:00 2001 From: andrew Date: Thu, 28 Sep 2023 17:47:50 -0400 Subject: [PATCH] Fix test assignment for repeated tests If a test with higher prio comes in, the worker might never swap off their current test --- OpenBench/workloads/get_workload.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenBench/workloads/get_workload.py b/OpenBench/workloads/get_workload.py index 45b8172..f047ced 100644 --- a/OpenBench/workloads/get_workload.py +++ b/OpenBench/workloads/get_workload.py @@ -94,9 +94,10 @@ def select_workload(machine): total_throughput = sum([x.throughput for x in tests]) fair_ratio = total_threads / total_throughput - # Repeat the same test if the distribution is still fair + # Repeat the same test if the distribution is fair, and has the previous test if min(ratios) / fair_ratio > 0.75: - return Test.objects.get(id=machine.workload) + if (test := Test.objects.get(id=machine.workload)) in tests: + return test # Fallback to simply doing the least attention given test return tests[random.choice(lowest_indices)]