Fix test assignment for repeated tests
If a test with higher prio comes in, the worker might never swap off their current test
This commit is contained in:
1 parent
8e0aa6a26b
commit
f35961e054
1 file changed
+3
-2
@@ -94,9 +94,10 @@ def select_workload(machine):
|
|||||||
total_throughput = sum([x.throughput for x in tests])
|
total_throughput = sum([x.throughput for x in tests])
|
||||||
fair_ratio = total_threads / total_throughput
|
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:
|
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
|
# Fallback to simply doing the least attention given test
|
||||||
return tests[random.choice(lowest_indices)]
|
return tests[random.choice(lowest_indices)]
|
||||||
|
|||||||
Reference in new issue
Block a user