Registering machines

This commit is contained in:
AndyGrant committed 2018-06-11 01:00:13 -04:00
1 parent 54ed339555
commit 45866bec60
10 files changed
+26 -425

No files matched your search

+1 -1
View File
@@ -45,7 +45,7 @@ class Machine(Model):
lastseen = DateTimeField(auto_now=True)
def __str__(self):
return '{0}-{1} ({2})'.format(self.owner.name, self.osname, self.id)
return '{0}-{1} ({2})'.format(self.owner, self.osname, self.id)
class Results(Model):
+1 -1
View File
@@ -26,7 +26,7 @@ urlpatterns = [
path(r'deleteTest/<int:id>/', OpenBench.views.deleteTest),
path(r'getFiles/', OpenBench.views.getFiles),
path(r'getWorkload/', OpenBench.views.getFiles),
path(r'getWorkload/', OpenBench.views.getWorkload),
path(r'submitResults/', OpenBench.views.submitResults),
path(r'invalidBench/', OpenBench.views.invalidBench),
]
+5 -2
View File
@@ -18,7 +18,7 @@ def getSourceLocation(branch, repo):
def verifyMachine(machineid, username, osname, threads):
# Machine does not exist, make a new one
if machineid == None:
if machineid == 'None':
machine = Machine()
machine.owner = username
machine.osname = osname
@@ -99,4 +99,7 @@ def newTest(request):
# Nothing seems to have gone wrong
test.save()
return test
return test
def getWorkload(threads):
pass
+8 -1
View File
@@ -364,7 +364,7 @@ def getWorkload(request):
return HttpResponse('Bad Credentials')
try: # Create or fetch the Machine
machine = verifyMachine(
machine = OpenBench.utils.verifyMachine(
request.POST['machineid'],
request.POST['username'],
request.POST['osname'],
@@ -372,6 +372,13 @@ def getWorkload(request):
except:
return HttpResponse('Bad Machine')
try: # Find an active Test to work on
test = OpenBench.utils.getWorkload(machine.threads)
except:
import traceback
print (traceback.print_exc())
return HttpResponse('None')
@csrf_exempt
def submitResults(request):
pass