Minimal changes to optimize basic client views
This commit is contained in:
1 parent
33f2e6d5df
commit
d230569e71
2 files changed
+19
-19
No files matched your search
+18
-17
@@ -267,19 +267,20 @@ def createNewTest(request):
|
|||||||
|
|
||||||
def getMachine(machineid, user, osname, threads):
|
def getMachine(machineid, user, osname, threads):
|
||||||
|
|
||||||
try: # Create a new or fetch an existing Machine
|
# Create a new Machine if needed
|
||||||
if machineid == 'None': machine = Machine()
|
if machineid == 'None':
|
||||||
else: machine = Machine.objects.get(id=int(machineid))
|
return Machine.objects.create(
|
||||||
except: return 'Bad Machine'
|
user=user, osname=osname, threads=threads)
|
||||||
|
|
||||||
# Verify that the fetched Machine matches
|
# Fetch and verify the requested Machine
|
||||||
if machineid != 'None':
|
try: machine = Machine.objects.get(id=int(machineid))
|
||||||
if machine.user != user: return 'Bad Machine'
|
except: return 'Bad Machine'
|
||||||
if machine.osname != osname: return 'Bad Machine'
|
if machine.user != user: return 'Bad Machine'
|
||||||
|
if machine.osname != osname: return 'Bad Machine'
|
||||||
|
|
||||||
# Update the Machine's running status
|
# Update the Machine's running status
|
||||||
machine.user = user ; machine.osname = osname
|
machine.threads = threads
|
||||||
machine.threads = int(threads) ; machine.mnps = 0.00
|
machine.mnps = 0.00
|
||||||
return machine
|
return machine
|
||||||
|
|
||||||
def getResult(test, machine):
|
def getResult(test, machine):
|
||||||
@@ -300,17 +301,17 @@ def getWorkload(user, request):
|
|||||||
threads = request.POST['threads' ]
|
threads = request.POST['threads' ]
|
||||||
|
|
||||||
# If we don't get a Machine back, there was an error
|
# If we don't get a Machine back, there was an error
|
||||||
machine = getMachine(machineid, user, osname, threads)
|
machine = getMachine(machineid, user, osname, int(threads))
|
||||||
if type(machine) == str: return machine
|
if type(machine) == str: return machine
|
||||||
machine.save()
|
|
||||||
|
|
||||||
# Compare supported Machines vs Existing
|
# Compare supported Machines vs Existing
|
||||||
supported = request.POST['supported'].split()
|
supported = request.POST['supported'].split()
|
||||||
existing = OPENBENCH_CONFIG['engines'].keys()
|
existing = OPENBENCH_CONFIG['engines'].keys()
|
||||||
|
|
||||||
# Filter only to active tests
|
# Filter only to active tests
|
||||||
tests = Test.objects.filter(finished=False).filter(deleted=False)
|
tests = Test.objects.filter(finished=False)
|
||||||
tests = tests.filter(deleted=False).filter(approved=True)
|
tests = tests.filter(deleted=False)
|
||||||
|
tests = tests.filter(approved=True)
|
||||||
|
|
||||||
# Remove tests that this Machine cannot complete
|
# Remove tests that this Machine cannot complete
|
||||||
for engine in existing:
|
for engine in existing:
|
||||||
@@ -341,14 +342,14 @@ def selectWorkload(tests, machine):
|
|||||||
if max(devthreads, basethreads) > machine.threads: continue
|
if max(devthreads, basethreads) > machine.threads: continue
|
||||||
|
|
||||||
# First Test or a higher priority Test
|
# First Test or a higher priority Test
|
||||||
if options == [] or test.priority > highest:
|
if not options or test.priority > highest:
|
||||||
highest = test.priority; options = [test]
|
highest = test.priority; options = [test]
|
||||||
|
|
||||||
# Another Test with an equal priority
|
# Another Test with an equal priority
|
||||||
elif options != [] and test.priority == highest:
|
elif options and test.priority == highest:
|
||||||
options.append(test)
|
options.append(test)
|
||||||
|
|
||||||
if options == []: return 'None'
|
if not options: return 'None'
|
||||||
|
|
||||||
target = random.randrange(sum([t.throughput for t in options]))
|
target = random.randrange(sum([t.throughput for t in options]))
|
||||||
while True: # Select a random test used weighted randomness
|
while True: # Select a random test used weighted randomness
|
||||||
|
|||||||
+1
-2
@@ -430,8 +430,7 @@ def clientGetFiles(request):
|
|||||||
# #
|
# #
|
||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
|
|
||||||
data = OpenBench.config.OPENBENCH_CONFIG['corefiles']
|
return HttpResponse(OpenBench.config.OPENBENCH_CONFIG['corefiles'])
|
||||||
return HttpResponse(str(data))
|
|
||||||
|
|
||||||
@not_minified_response
|
@not_minified_response
|
||||||
def clientGetBuildInfo(request):
|
def clientGetBuildInfo(request):
|
||||||
|
|||||||
Reference in new issue
Block a user