Implement workload blacklisting (#214)
Closes #213 Co-authored-by: Andrew Grant <andrew.github@grantnet.us>
This commit is contained in:
1 parent
00ca2e524e
commit
8f6d86eb5f
3 files changed
+13
-7
No files matched your search
+3
-1
@@ -88,6 +88,7 @@ class Configuration:
|
|||||||
self.machine_id = 'None'
|
self.machine_id = 'None'
|
||||||
self.secret_token = 'None'
|
self.secret_token = 'None'
|
||||||
self.syzygy_max = 2
|
self.syzygy_max = 2
|
||||||
|
self.blacklist = []
|
||||||
|
|
||||||
self.process_args(args) # Rest of the command line settings
|
self.process_args(args) # Rest of the command line settings
|
||||||
self.init_client() # Create folder structure and verify Syzygy
|
self.init_client() # Create folder structure and verify Syzygy
|
||||||
@@ -915,7 +916,7 @@ def server_request_workload(config):
|
|||||||
|
|
||||||
print('\nRequesting Workload from Server...')
|
print('\nRequesting Workload from Server...')
|
||||||
|
|
||||||
payload = { 'machine_id' : config.machine_id, 'secret' : config.secret_token }
|
payload = { 'machine_id' : config.machine_id, 'secret' : config.secret_token, 'blacklist' : config.blacklist }
|
||||||
target = url_join(config.server, 'clientGetWorkload')
|
target = url_join(config.server, 'clientGetWorkload')
|
||||||
response = requests.post(target, data=payload, timeout=TIMEOUT_HTTP)
|
response = requests.post(target, data=payload, timeout=TIMEOUT_HTTP)
|
||||||
|
|
||||||
@@ -1084,6 +1085,7 @@ def safe_download_engine(config, branch, net_path):
|
|||||||
print ('> %s' % (line))
|
print ('> %s' % (line))
|
||||||
print ()
|
print ()
|
||||||
|
|
||||||
|
config.blacklist.append(config.workload['test']['id'])
|
||||||
ServerReporter.report_build_fail(config, branch, error.logs)
|
ServerReporter.report_build_fail(config, branch, error.logs)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -717,7 +717,7 @@ def client_get_network(request, engine, name):
|
|||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
@verify_worker
|
@verify_worker
|
||||||
def client_get_workload(request, machine):
|
def client_get_workload(request, machine):
|
||||||
return JsonResponse(get_workload(machine))
|
return JsonResponse(get_workload(request, machine))
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
@verify_worker
|
@verify_worker
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ from OpenBench.models import Result, Test
|
|||||||
|
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
||||||
def get_workload(machine):
|
def get_workload(request, machine):
|
||||||
|
|
||||||
# Select a workload from the possible ones, if we can
|
# Select a workload from the possible ones, if we can
|
||||||
if not (test := select_workload(machine)):
|
if not (test := select_workload(request, machine)):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
# Avoid creating duplicate Result objects
|
# Avoid creating duplicate Result objects
|
||||||
@@ -51,10 +51,10 @@ def get_workload(machine):
|
|||||||
|
|
||||||
return { 'workload' : workload_to_dictionary(test, result, machine) }
|
return { 'workload' : workload_to_dictionary(test, result, machine) }
|
||||||
|
|
||||||
def select_workload(machine):
|
def select_workload(request, machine):
|
||||||
|
|
||||||
# Step 1: Refine active workloads to the candidate assignments
|
# Step 1: Refine active workloads to the candidate assignments
|
||||||
candidates, has_focus = filter_valid_workloads(machine)
|
candidates, has_focus = filter_valid_workloads(request, machine)
|
||||||
if not candidates:
|
if not candidates:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ def select_workload(machine):
|
|||||||
weights = [data['throughput'] for id, data in worker_dist.items() if data['ratio'] == min_ratio]
|
weights = [data['throughput'] for id, data in worker_dist.items() if data['ratio'] == min_ratio]
|
||||||
return Test.objects.get(id=random.choices(choices, weights=weights)[0])
|
return Test.objects.get(id=random.choices(choices, weights=weights)[0])
|
||||||
|
|
||||||
def filter_valid_workloads(machine):
|
def filter_valid_workloads(request, machine):
|
||||||
|
|
||||||
workloads = OpenBench.utils.get_active_tests()
|
workloads = OpenBench.utils.get_active_tests()
|
||||||
|
|
||||||
@@ -97,6 +97,10 @@ def filter_valid_workloads(machine):
|
|||||||
workloads = workloads.exclude(dev_engine=engine)
|
workloads = workloads.exclude(dev_engine=engine)
|
||||||
workloads = workloads.exclude(base_engine=engine)
|
workloads = workloads.exclude(base_engine=engine)
|
||||||
|
|
||||||
|
# Skip workloads that are blacklisted on the machine
|
||||||
|
if blacklisted := request.POST.getlist('blacklist'):
|
||||||
|
workloads = workloads.exclude(id__in=blacklisted)
|
||||||
|
|
||||||
# Skip workloads with unmet Syzygy requirements
|
# Skip workloads with unmet Syzygy requirements
|
||||||
for K in range(machine.info['syzygy_max'] + 1, 10):
|
for K in range(machine.info['syzygy_max'] + 1, 10):
|
||||||
workloads = workloads.exclude(syzygy_adj='%d-MAN' % (K))
|
workloads = workloads.exclude(syzygy_adj='%d-MAN' % (K))
|
||||||
|
|||||||
Reference in new issue
Block a user