diff --git a/OpenBench/models.py b/OpenBench/models.py index 65868b9..9ad233f 100644 --- a/OpenBench/models.py +++ b/OpenBench/models.py @@ -25,6 +25,9 @@ class Machine(Model): owner = CharField(max_length=64) osname = CharField(max_length=128) + + cores = IntegerField(default=0) + mnps = FloatField(default=0.00) lastseen = DateTimeField(auto_now=True) def __str__(self): @@ -41,7 +44,6 @@ class Results(Model): draws = IntegerField(default=0) crashes = IntegerField(default=0) time = IntegerField(default=0) - lastseen = DateTimeField(default=0) def __str__(self): @@ -80,11 +82,12 @@ class Test(Model): passed = BooleanField(default=False) failed = BooleanField(default=False) + finished = BooleanField(default=False) deleted = BooleanField(default=False) approved = BooleanField(default=False) creation = DateTimeField(auto_now=True) - complted = DateTimeField(auto_now=True) + completion = DateTimeField(auto_now=True) def __str__(self): return '{0} vs {1} @ {2}'.format(self.dev.name, self.base.name, self.timecontrol) diff --git a/OpenBench/static/style.css b/OpenBench/static/style.css new file mode 100644 index 0000000..b36fc26 --- /dev/null +++ b/OpenBench/static/style.css @@ -0,0 +1,136 @@ +body { + font-family: "Courier New"; + font-size: 20px; +} + +#sidebar { + float: left; + margin: 20px; + padding-right: 20px; +} + +#content { + float: left; + padding-top: 20px; + padding-bottom: 20px; + display: block; + width: auto; +} + +#errormessagebar { + background-color: RED; + padding: 8px; + text-align: center; +} + +table { + background-color: none; +} + +.tabletitle { + background-color: GREEN; + font-size: 20px; +} + +th, td { + border: 1px solid black; +} + +th { + text-align: center; + padding: 3px 16px; + background-color: #4CAF50; + color: white; +} + +td { + padding: 2px 16px; + text-align: right; +} + +tr:nth-child(even){background-color: #DBDBDB} +tr:nth-child(odd){background-color: #BDBDBD} + +.failed:nth-child(even){background-color: #FAA5A5} +.failed:nth-child(odd){background-color: #FA8E8E} + +.passed:nth-child(even){background-color: #2FFA62} +.passed:nth-child(odd){background-color: #9DF779} + +.active:nth-child(even){background-color: #E9FA32} +.active:nth-child(odd){background-color: #EEF788} + +ul { + list-style-type: none; + display: block; + margin: 20px 0px 0px 0px; + padding-left: 10px; +} + +li { + margin: 8px; +} + +.listheader { + font-weight: bold; + color: grey; +} + +table { + line-height: 75%; +} + +a:link, a:visited, a:hover, a:active { + text-decoration: none; + color: blue; +} + + +#pagebrowse { + display: inline-block; + text-align: center; + width: 100%; + margin-top: 8px; +} + +.page { + border-style: solid; + border-width: 2px; + border-color: black; + border-radius: 4px; + font-weight: bold; + text-align: center; + display: inline-block; + padding-top : 8px; + padding-bottom: 8px; + width: 5%; +} + +input[type=text], input[type=password], textarea, select { + padding: 8px 6px; + display: inline-block; + vertical-align: middle; + width: 400px; +} + +input[type=submit] { + background-color: #4CAF50; + color: white; + padding: 8px 6px; + margin: 8px 0; + border: none; + border-radius: 4px; + cursor: pointer; + width: 100%; +} + +input[type=submit]:hover { + background-color: #45a049; +} + +label, option { + display: inline-block; + width: 140px; + font-weight:bold; + vertical-align: middle; +} diff --git a/OpenBench/templatetags/mytags.py b/OpenBench/templatetags/mytags.py new file mode 100644 index 0000000..b577b95 --- /dev/null +++ b/OpenBench/templatetags/mytags.py @@ -0,0 +1,49 @@ +from django import template + +from OpenBench.models import Test + +def oneDigitPrecision(value): + try: + value = round(value, 1) + if "." not in str(value): + return str(value) + ".0" + pre, post = str(value).split(".") + post += "0" + return pre + "." + post[0:1] + except: + return value + +def twoDigitPrecision(value): + try: + value = round(value, 2) + if "." not in str(value): + return str(value) + ".00" + pre, post = str(value).split(".") + post += "00" + return pre + "." + post[0:2] + except: + return value + +def gitDiffLink(test): + + if type(test) != Test: + dev = test["dev"]["source"] + base = test["base"]["source"] + devsha = test["dev"]["sha"] + basesha = test["base"]["sha"] + + else: + dev = test.dev.source + base = test.base.source + devsha = test.dev.sha + basesha = test.base.sha + + repo = "/".join(dev.split("/")[:-2]) + + return "{0}/compare/{1}...{2}".format(repo, basesha[:8], testsha[:8]) + +register = template.Library() +register.filter("oneDigitPrecision", oneDigitPrecision) +register.filter("twoDigitPrecision", twoDigitPrecision) +register.filter("gitDiffLink", gitDiffLink) + diff --git a/OpenBench/views.py b/OpenBench/views.py index e20f2de..6f3cde2 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -9,15 +9,13 @@ from django.contrib.auth.models import User from OpenBench.config import * -from OpenBench.models import LogEvent +from OpenBench.models import LogEvent, Machine, Test # Wrap django.shortcuts.render to add framework settings def render(request, template, data): data.update(FRAMEWORK_DEFAULTS) return djangoRender(request, 'OpenBench/{0}'.format(template), data) -## ADMIN - def register(request): # User trying to view the registration page @@ -59,8 +57,6 @@ def logout(request): logoutUser(request) return HttpResponseRedirect("/index/") -## CONTENT VIEWING - def eventLog(request): # Build context dictionary for template @@ -73,9 +69,36 @@ def eventLog(request): return render(request, "eventLog.html", data) def index(request, page=0): - pass -## TEST MANAGMENT + # Get tests pending approval + pending = Test.objects.filter(approved=False) + pending = pending.exclude(deleted=True) + pending = pending.order_by('creation') + + # Get tests currently running + active = Test.objects.filter(approved=True) + active = active.exclude(passed=True) + active = active.exclude(failed=True) + active = active.exclude(deleted=True) + active = active.order_by('priority', 'currentllr') + + # Get the last 50 completed tests + completed = Test.objects.filter(finished=True) + completed = completed.exclude(deleted=True) + completed = completed.order_by('completion') + + # Get machines currently active workloads + # machines = Machine.objects.get() + # machines = Machines played within last + # Save my @nitrocan @defenchess + + data = { + 'pending' : [], + 'active' : [], + 'completed' : [], + } + + return render(request, 'index.html', data) def newTest(request): pass @@ -89,8 +112,6 @@ def viewTest(request, id): def approveTest(request, id): pass -## CLIENT TARGETS - def getFiles(request): pass diff --git a/OpenSite/settings.py b/OpenSite/settings.py index 0375b9c..9b47059 100644 --- a/OpenSite/settings.py +++ b/OpenSite/settings.py @@ -43,6 +43,7 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'OpenBench', + 'OpenBench.templatetags', ] MIDDLEWARE = [ diff --git a/Templates/OpenBench/index.html b/Templates/OpenBench/index.html index 0eafea9..199d85d 100644 --- a/Templates/OpenBench/index.html +++ b/Templates/OpenBench/index.html @@ -1,5 +1,7 @@ {% extends "OpenBench/base.html" %} +{% load mytags %} + {% block title %} Index {% endblock %} @@ -7,12 +9,12 @@ Index {% block content %} - - - + + + - {% for test in pendingtests %} + {% for test in pending %} + {% endfor %}
TEST DIFF APPROVE TESTDIFFAPPROVE
{{test.dev.name}} @@ -22,16 +24,18 @@ Index approve
- - - - + + + + + - {% for test in activetests %} + {% for test in active %} + {% endfor %} + + {% for test in completed %} + + + + + + + {% endfor %}
TEST DIFF STATS ELO AUTHORTESTDIFFSTATSELO
{{test.dev.name}} @@ -48,5 +52,25 @@ Index {{enginetest.elo|twoDigitPrecision}}
+ {{test.dev.name}} + + diff + + SPRT @ {{test.timecontrol}}s Threads={{test.threads}} Hash={{test.hashsize}}MB
+ LLR: {{test.currentllr|twoDigitPrecision}} ({{test.lowerllr|twoDigitPrecision}}, + {{test.upperllr|twoDigitPrecision}}) [{{test.elolower|twoDigitPrecision}}, + {{test.eloupper|twoDigitPrecision}}]
Games: {{test.games}} + W: {{test.wins}} L: {{test.losses}} D: {{test.draws}} +
{{enginetest.elo|twoDigitPrecision}}
{% endblock %} \ No newline at end of file diff --git a/db.sqlite3 b/db.sqlite3 index 71f4192..b59a7d0 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ