Reporting NPS
This commit is contained in:
1 parent
dcce521447
commit
ab92826282
5 files changed
+63
-29
No files matched your search
@@ -28,5 +28,6 @@ urlpatterns = [
|
||||
path(r'getFiles/', OpenBench.views.getFiles),
|
||||
path(r'getWorkload/', OpenBench.views.getWorkload),
|
||||
path(r'wrongBench/', OpenBench.views.wrongBench),
|
||||
path(r'submitNPS/', OpenBench.views.submitNPS),
|
||||
path(r'submitResults/', OpenBench.views.submitResults),
|
||||
]
|
||||
+5
-5
@@ -81,7 +81,7 @@ def getMachine(machineid, username, osname, threads):
|
||||
|
||||
# Client has no saved machine ID, make a new machine
|
||||
if machineid == 'None':
|
||||
return Machine.objects.create(owner=username, osname=osname, threads=threads)
|
||||
return Machine.objects.create(owner=username, osname=osname, threads=int(threads))
|
||||
|
||||
# Fetch and verify the claimed machine ID
|
||||
machine = Machine.objects.get(id=machineid)
|
||||
@@ -89,7 +89,7 @@ def getMachine(machineid, username, osname, threads):
|
||||
assert machine.osname == osname
|
||||
|
||||
# Update to reflect new worload
|
||||
machine.threads = threads
|
||||
machine.threads = int(threads)
|
||||
machine.mnps = 0.00
|
||||
machine.save()
|
||||
return machine
|
||||
@@ -102,7 +102,7 @@ def getWorkload(machine):
|
||||
tests = list(tests.filter(approved=True))
|
||||
|
||||
# No tests, error out and let views handle it
|
||||
if len(tests) == 0: raise Exception('ANone')
|
||||
if len(tests) == 0: raise Exception('None')
|
||||
|
||||
options = [] # Highest priority with acceptable threads
|
||||
|
||||
@@ -111,11 +111,11 @@ def getWorkload(machine):
|
||||
|
||||
# Find Threads for the Dev Engine
|
||||
tokens = test.devoptions.split(' ')
|
||||
devthreads = tokens[0].split('=')[1]
|
||||
devthreads = int(tokens[0].split('=')[1])
|
||||
|
||||
# Find Threads for the Base Engine
|
||||
tokens = test.baseoptions.split(' ')
|
||||
basethreads = tokens[0].split('=')[1]
|
||||
basethreads = int(tokens[0].split('=')[1])
|
||||
|
||||
# Minimum threads to support Dev & Base
|
||||
threadcnt = max(devthreads, basethreads)
|
||||
|
||||
+34
-14
@@ -113,7 +113,7 @@ def index(request, page=0, username=None, error=''):
|
||||
|
||||
# Get tests pending approval
|
||||
pending = Test.objects.filter(approved=False)
|
||||
pending = pending.exclude(finished=False)
|
||||
pending = pending.exclude(finished=True)
|
||||
pending = pending.exclude(deleted=True)
|
||||
pending = pending.order_by('-creation')
|
||||
|
||||
@@ -383,21 +383,41 @@ def wrongBench(request):
|
||||
password=request.POST['password']))
|
||||
except: return HttpResponse('Bad Credentials')
|
||||
|
||||
# Find the engine with the bad bench
|
||||
engineid = int(request.POST['engineid'])
|
||||
engine = Engine.objects.get(id=engineid)
|
||||
try:
|
||||
# Find the engine with the bad bench
|
||||
engineid = int(request.POST['engineid'])
|
||||
engine = Engine.objects.get(id=engineid)
|
||||
|
||||
# Find and stop the test with the bad bench
|
||||
testid = int(request.POST['testid'])
|
||||
test = Test.objects.get(id=testid)
|
||||
test.finished = True
|
||||
test.save()
|
||||
# Find and stop the test with the bad bench
|
||||
testid = int(request.POST['testid'])
|
||||
test = Test.objects.get(id=testid)
|
||||
test.finished = True
|
||||
test.save()
|
||||
|
||||
# Log the bad bench so we know why the test was stopped
|
||||
LogEvent.objects.create(
|
||||
data='Invalid bench for {0} with {1}'.format(str(test), str(engine)),
|
||||
author=request.POST['username']
|
||||
)
|
||||
# Log the bad bench so we know why the test was stopped
|
||||
LogEvent.objects.create(
|
||||
data='Invalid bench for {0} with {1}'.format(str(test), str(engine)),
|
||||
author=request.POST['username']
|
||||
)
|
||||
except: pass
|
||||
|
||||
return HttpResponse('None')
|
||||
|
||||
@csrf_exempt
|
||||
def submitNPS(request):
|
||||
|
||||
# Attempt to login in user
|
||||
try: loginUser(request, authenticate(
|
||||
username=request.POST['username'],
|
||||
password=request.POST['password']))
|
||||
except: return HttpResponse('Bad Credentials')
|
||||
|
||||
# Try to update the NPS for the machine
|
||||
try:
|
||||
machine = Machine.objects.get(id=int(request.POST['machineid']))
|
||||
machine.mnps = float(request.POST['nps']) / 1e6
|
||||
machine.save()
|
||||
except: return HttpResponse('Bad Machine ID')
|
||||
|
||||
return HttpResponse('None')
|
||||
|
||||
|
||||
Reference in new issue
Block a user