Partial work cleaning up front & backends

This commit is contained in:
AndyGrant committed 2020-02-17 05:58:40 -05:00
1 parent 09cc9d1949
commit 9c488fb521
17 files changed
+483 -349

No files matched your search

+20
View File
@@ -1,3 +1,23 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# OpenBench is a chess engine testing framework authored by Andrew Grant. #
# <https://github.com/AndyGrant/OpenBench> <andrew@grantnet.us> #
# #
# OpenBench is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# OpenBench is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
from __future__ import print_function
import argparse, ast, hashlib, json, math, multiprocessing, os
+27 -8
View File
@@ -1,9 +1,28 @@
from django.contrib import admin
from OpenBench.models import LogEvent, Engine, Profile, Machine, Result, Test
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# OpenBench is a chess engine testing framework authored by Andrew Grant. #
# <https://github.com/AndyGrant/OpenBench> <andrew@grantnet.us> #
# #
# OpenBench is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# OpenBench is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
admin.site.register(LogEvent)
admin.site.register(Engine)
admin.site.register(Profile)
admin.site.register(Machine)
admin.site.register(Result)
admin.site.register(Test)
import django.contrib, OpenBench.models
django.contrib.admin.site.register(OpenBench.models.Engine)
django.contrib.admin.site.register(OpenBench.models.Profile)
django.contrib.admin.site.register(OpenBench.models.Machine)
django.contrib.admin.site.register(OpenBench.models.Result)
django.contrib.admin.site.register(OpenBench.models.Test)
django.contrib.admin.site.register(OpenBench.models.LogEvent)
+22 -2
View File
@@ -1,4 +1,24 @@
from django.apps import AppConfig
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# OpenBench is a chess engine testing framework authored by Andrew Grant. #
# <https://github.com/AndyGrant/OpenBench> <andrew@grantnet.us> #
# #
# OpenBench is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# OpenBench is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class OpenbenchConfig(AppConfig):
import django.apps
class OpenbenchConfig(django.apps.AppConfig):
name = 'OpenBench'
+105 -103
View File
@@ -1,122 +1,124 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# OpenBench is a chess engine testing framework authored by Andrew Grant. #
# <https://github.com/AndyGrant/OpenBench> <andrew@grantnet.us> #
# #
# OpenBench is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# OpenBench is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Workers will use FRAMEWORK_REPO_URL to determine the location
# for the Cutechess binary and DLLs, as well as any of the books
# which are being used in the testing framework. The main OpenBench
# repo should suffice, but new books require this to be redirected.
FRAMEWORK_REPO_URL = 'http://github.com/AndyGrant/OpenBench/'
OPENBENCH_CONFIG = {
FRAMEWORK_DEFAULTS = {
# Sidebar link, location of resources, and contact information
'framework' : 'http://github.com/AndyGrant/OpenBench/',
'corefiles' : 'http://github.com/AndyGrant/OpenBench/raw/master/CoreFiles/',
'serveradmin' : 'andrew@grantnet.us',
'config' : {
# SPRT Elo bounds and type I/II errors
'sprt' : { 'elolower' : 0.00, 'eloupper' : 5.00, 'alpha' : 0.05, 'beta' : 0.05 },
# Controls the Link on the sidebar
'framework' : FRAMEWORK_REPO_URL,
# Email of OpenBench instance owner
'serveradmin' : 'andrew@grantnet.us',
# Book confgiruation. When addding a book, follow the provided template.
# The SHA is defined by hashlib.sha256(book).hexdigest(). OpenBench.py
# (Client File) has an example to show you how to find a hash digest
# SPRT Elo bounds and type I/II errors
'sprt' : {
'elolower' : 0.00, 'eloupper' : 5.00,
'alpha' : 0.05, 'beta' : 0.05,
'books' : {
'2moves_v1.pgn' : {
'sha' : '46aed7f2696618b2b914942032957b7a97a8f343bf54ba83e20a47818f0d42e0',
'source' : 'http://github.com/AndyGrant/OpenBench/raw/master/Books/2moves_v1.pgn',
'default' : True,
},
# Engine Configuration. All engines must have a name, a source repo,
# a set of paramaters for each standard test type, as well as a scaled
# NPS value, which is used to normalize speed across all workers.
'8moves_v3.pgn' : {
'sha' : '04fcce1488a94f3b7795cef6f74d89016eb278328897c1018e6162c5967273f5',
'source' : 'http://github.com/AndyGrant/OpenBench/raw/master/Books/8moves_v3.pgn',
'default' : False,
},
'engines' : {
'Ethereal' : {
'proto' : 'uci',
'nps' : 1275000,
'name' : 'Ethereal',
'source' : 'https://github.com/AndyGrant/Ethereal',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
},
},
'3moves_FRC.pgn' : {
'sha' : '4c801140e3a52d3a306cb226ccd6225c47789409c5f2d0e1d7cf86152ea1f973',
'source' : 'http://github.com/AndyGrant/OpenBench/raw/master/Books/3moves_FRC.pgn',
'default' : False,
},
},
'Laser' : {
'proto' : 'uci',
'nps' : 710000,
'name' : 'Laser',
'source' : 'https://github.com/jeffreyan11/uci-chess-engine',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
},
},
'Weiss' : {
'proto' : 'uci',
'nps' : 2675000,
'name' : 'Weiss',
'source' : 'https://github.com/TerjeKir/weiss',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 128, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 128, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 512, 'timecontrol' : '20.0+0.2' },
},
},
# Engine Configuration. All engines must have a name, a source repo,
# a set of paramaters for each standard test type, as well as a scaled
# NPS value, which is used to normalize speed across all workers.
'Demolito' : {
'proto' : 'uci',
'nps' : 1250000,
'name' : 'Demolito',
'source' : 'https://github.com/lucasart/Demolito',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '32.0+0.32'},
'smpstc' : { 'threads' : 8, 'hash' : 32, 'timecontrol' : '4.0+0.04' },
'smpltc' : { 'threads' : 8, 'hash' : 128, 'timecontrol' : '16.0+0.16'},
},
},
'engines' : {
'RubiChess' : {
'proto' : 'uci',
'nps' : 1000000,
'name' : 'RubiChess',
'source' : 'https://github.com/Matthies/RubiChess',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
},
'Ethereal' : {
'proto' : 'uci',
'nps' : 1275000,
'source' : 'https://github.com/AndyGrant/Ethereal',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '12.0+0.12' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
},
},
'Laser' : {
'proto' : 'uci',
'nps' : 710000,
'source' : 'https://github.com/jeffreyan11/uci-chess-engine',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
},
},
'Weiss' : {
'proto' : 'uci',
'nps' : 2675000,
'source' : 'https://github.com/TerjeKir/weiss',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 128, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 128, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 512, 'timecontrol' : '20.0+0.2' },
},
},
# Book confgiruation. When addding a book, follow the provided template.
# The SHA is defined by hashlib.sha256(book).hexdigest(). OpenBench.py
# (Client File) has an example to show you how to find a hash digest
'books' : {
'2moves_v1.pgn' : {
'name' : '2moves_v1.pgn',
'sha' : '46aed7f2696618b2b914942032957b7a97a8f343bf54ba83e20a47818f0d42e0',
'source' : FRAMEWORK_REPO_URL + 'raw/master/Books/2moves_v1.pgn',
'default' : True,
},
'8moves_v3.pgn' : {
'name' : '8moves_v3.pgn',
'sha' : '04fcce1488a94f3b7795cef6f74d89016eb278328897c1018e6162c5967273f5',
'source' : FRAMEWORK_REPO_URL + 'raw/master/Books/8moves_v3.pgn',
'default' : False,
},
'3moves_FRC.pgn' : {
'name' : '3moves_FRC.pgn',
'sha' : '4c801140e3a52d3a306cb226ccd6225c47789409c5f2d0e1d7cf86152ea1f973',
'source' : FRAMEWORK_REPO_URL + 'raw/master/Books/3moves_FRC.pgn',
'default' : False,
'Demolito' : {
'proto' : 'uci',
'nps' : 1250000,
'source' : 'https://github.com/lucasart/Demolito',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '32.0+0.32'},
'smpstc' : { 'threads' : 8, 'hash' : 32, 'timecontrol' : '4.0+0.04' },
'smpltc' : { 'threads' : 8, 'hash' : 128, 'timecontrol' : '16.0+0.16'},
},
},
}
'RubiChess' : {
'proto' : 'uci',
'nps' : 1000000,
'source' : 'https://github.com/Matthies/RubiChess',
'testmodes' : {
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' },
},
},
},
}
+20
View File
@@ -1,3 +1,23 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# OpenBench is a chess engine testing framework authored by Andrew Grant. #
# <https://github.com/AndyGrant/OpenBench> <andrew@grantnet.us> #
# #
# OpenBench is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# OpenBench is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
from django.db.models import CharField, IntegerField, BooleanField, FloatField
from django.db.models import ForeignKey, DateTimeField, OneToOneField
from django.db.models import CASCADE, PROTECT, Model
+50 -73
View File
@@ -1,7 +1,7 @@
body {
font-family: "Courier New";
font-size: 16px;
background: #2A2A2A;
font-size: 18px;
background: #303030;
}
a:link, a:visited, a:hover, a:active {
@@ -11,36 +11,36 @@ a:link, a:visited, a:hover, a:active {
#sidebar {
float: left;
margin: 20px;
margin: 16px;
}
#sidebar ul {
list-style-type: none;
padding: 0px;
padding: 0px 16px;
}
#sidebar li a {
font-size: 18px;
color: #A2A2A2;
}
#sidebar .header {
font-weight: bold;
color: #00CCFF;
font-size: 16px;
color: #00AF00;
}
#content {
float: left;
padding: 20px 0px;
margin-top: 32px;
color: #EAEAEA;
}
#content label {
width: 120px;
width: 128px;
padding-right: 10px;
font-weight:bold;
text-align: right;
display: inline-block;
color: #A2A2A2;
font-size: 16px;
}
#content input, #content select {
@@ -62,32 +62,28 @@ a:link, a:visited, a:hover, a:active {
display: inline-block;
vertical-align: middle;
width: 290px;
background-color: #00CCFF;
background-color: #777777;
color: black;
border: none;
border-radius: 8px;
border-radius: 16px;
cursor: pointer;
font-weight: bold;
}
#content button:hover {
background-color: #FFFFFF;
background-color: #00AF00;
}
#content input[type=submit] {
background-color: #00CCFF;
background-color: #00AF00;
color: #000000;
border: none;
border-radius: 8px;
border-radius: 16px;
cursor: pointer;
width: 100%;
font-weight: bold;
}
#content input[type=submit]:hover {
background-color: #FFFFFF;
}
#content input:read-only {
font-weight: bold;
}
@@ -101,28 +97,8 @@ a:link, a:visited, a:hover, a:active {
margin-top: 20px;
}
#content .summarytable th {
padding-top: 20px;
padding-right: 10px;
padding-bottom: 20px;
font-size: 16px;
color: #00CCFF;
}
#content .rawtable td {
padding-right: 20px;
}
#content .rawtable th {
padding-right: 20px;
text-align: left;
}
#content .rawtable .numeric {
text-align: right;
}
#content #actions {
margin-left: 32px;
float: right;
}
@@ -130,7 +106,7 @@ a:link, a:visited, a:hover, a:active {
color: #000000;
padding: 8px 8px;
margin: 0px 8px;
border-radius: 8px;
border-radius: 16px;
font-weight: bold;
text-align: center;
display: inline-block;
@@ -138,7 +114,7 @@ a:link, a:visited, a:hover, a:active {
}
#content #actions .anchorbutton a:hover {
background-color: #FFFFFF;
background-color: #00AF00;
}
#content #actions #approvebutton {
@@ -170,59 +146,59 @@ a:link, a:visited, a:hover, a:active {
width: 100%;
}
#content .datatable th {
color: #FFFFFF;
font-size: 20px;
padding: 6px 12px;
background-color: #2A2A2A;
#content .left-align {
text-align: left;
}
#content .datatable td {
#content tr:hover {
background-color: #00AF00;
}
#content th {
color: #00AF00;
font-size: 16px;
padding: 6px 12px;
background-color: #000000;
}
#content td {
padding: 6px 12px;
}
#content .datatable .numeric {
#content .numeric {
text-align: right;
}
#content .datatable tr {
background-color: #212121;
#content tr {
background-color: #1A1A1A;
}
#content .datatable .embedded {
border: none;
text-align: left;
padding-left: 0px;
background: #2A2A2A;
#content .table-spacer th {
background: #303030;
height: 16px;
}
#content .datatable .embedded h2 {
margin: 16px 0px 0px 0px;
color: #00CCFF;
}
#content .datatable .statblock {
#content .statblock {
line-height: 70%;
color: black;
background-color: #AAAAAA;
background-color: #CCCCCC;
border-radius: 4px;
}
#content .datatable .green {
#content .green {
background-color: #9DF779
}
#content .datatable .yellow {
#content .yellow {
background-color: #EEF788
}
#content .datatable .red {
#content .red {
background-color: #FA8E8E
}
#content #results {
display: inline-block;
margin-top: 50px;
width: inherit;
}
@@ -244,7 +220,7 @@ a:link, a:visited, a:hover, a:active {
#content #pagebrowse {
text-align: center;
margin-top: 16px;
margin: 16px 0px 16px 0px;
}
#content .page {
@@ -252,12 +228,12 @@ a:link, a:visited, a:hover, a:active {
display: inline-block;
padding: 8px 0px;
width: 5%;
background-color: #212121;
background-color: #1A1A1A;
border-radius: 8px;
}
#content .page:hover {
background-color: #AAAAAA;
background-color: #00AF00;
}
#error {
@@ -269,14 +245,15 @@ a:link, a:visited, a:hover, a:active {
}
#content form h3 {
margin-left: 130px;
margin-left: 140px;
margin-bottom: 0px;
color: #00CCFF;
font-size: 16px;
color: #00AF00;
}
#content form .settings-column {
float: left;
padding-bottom: 4px;
padding-bottom: 16px;
}
#content #test-mode-buttons button {
-3
View File
@@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.
+55 -31
View File
@@ -1,41 +1,65 @@
from django.urls import path
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# OpenBench is a chess engine testing framework authored by Andrew Grant. #
# <https://github.com/AndyGrant/OpenBench> <andrew@grantnet.us> #
# #
# OpenBench is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# OpenBench is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
import OpenBench.views
import django.urls, OpenBench.views
urlpatterns = [
path(r'register/', OpenBench.views.register),
path(r'login/', OpenBench.views.login),
path(r'logout/', OpenBench.views.logout),
path(r'viewProfile/', OpenBench.views.viewProfile),
path(r'editProfile/', OpenBench.views.editProfile),
# Links for account managment
django.urls.path(r'register/', OpenBench.views.register),
django.urls.path(r'login/', OpenBench.views.login),
django.urls.path(r'logout/', OpenBench.views.logout),
django.urls.path(r'viewProfile/', OpenBench.views.viewProfile),
django.urls.path(r'editProfile/', OpenBench.views.editProfile),
path(r'index/', OpenBench.views.index),
path(r'index/<int:page>/', OpenBench.views.index),
path(r'greens/', OpenBench.views.greens),
path(r'greens/<int:page>/', OpenBench.views.greens),
path(r'search/', OpenBench.views.search),
path(r'viewUser/<str:username>/', OpenBench.views.viewUser),
path(r'viewUser/<str:username>/<int:page>/', OpenBench.views.viewUser),
# Links for viewing test tables
django.urls.path(r'index/', OpenBench.views.index),
django.urls.path(r'index/<int:page>/', OpenBench.views.index),
django.urls.path(r'greens/', OpenBench.views.greens),
django.urls.path(r'greens/<int:page>/', OpenBench.views.greens),
django.urls.path(r'search/', OpenBench.views.search),
django.urls.path(r'viewUser/<str:username>/', OpenBench.views.viewUser),
django.urls.path(r'viewUser/<str:username>/<int:page>/', OpenBench.views.viewUser),
path(r'users/', OpenBench.views.users),
path(r'machines/', OpenBench.views.machines),
path(r'eventLog/', OpenBench.views.eventLog),
path(r'eventLog/<int:page>/', OpenBench.views.eventLog),
# Links for viewing general information tables
django.urls.path(r'users/', OpenBench.views.users),
django.urls.path(r'machines/', OpenBench.views.machines),
django.urls.path(r'eventLog/', OpenBench.views.eventLog),
django.urls.path(r'eventLog/<int:page>/', OpenBench.views.eventLog),
path(r'newTest/', OpenBench.views.newTest),
path(r'viewTest/<int:id>/', OpenBench.views.viewTest),
path(r'editTest/<int:id>/', OpenBench.views.editTest),
path(r'approveTest/<int:id>/', OpenBench.views.approveTest),
path(r'restartTest/<int:id>/', OpenBench.views.restartTest),
path(r'stopTest/<int:id>/', OpenBench.views.stopTest),
path(r'deleteTest/<int:id>/', OpenBench.views.deleteTest),
# Links for viewing and managing tests
django.urls.path(r'newTest/', OpenBench.views.newTest),
django.urls.path(r'viewTest/<int:id>/', OpenBench.views.viewTest),
django.urls.path(r'editTest/<int:id>/', OpenBench.views.editTest),
django.urls.path(r'approveTest/<int:id>/', OpenBench.views.approveTest),
django.urls.path(r'restartTest/<int:id>/', OpenBench.views.restartTest),
django.urls.path(r'stopTest/<int:id>/', OpenBench.views.stopTest),
django.urls.path(r'deleteTest/<int:id>/', OpenBench.views.deleteTest),
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),
# Links for the Client to update the Server
django.urls.path(r'getFiles/', OpenBench.views.getFiles),
django.urls.path(r'getWorkload/', OpenBench.views.getWorkload),
django.urls.path(r'wrongBench/', OpenBench.views.wrongBench),
django.urls.path(r'submitNPS/', OpenBench.views.submitNPS),
django.urls.path(r'submitResults/', OpenBench.views.submitResults),
path(r'', OpenBench.views.index),
# Redirect anything else to the Index
django.urls.path(r'', OpenBench.views.index),
]
+24 -4
View File
@@ -1,3 +1,23 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# OpenBench is a chess engine testing framework authored by Andrew Grant. #
# <https://github.com/AndyGrant/OpenBench> <andrew@grantnet.us> #
# #
# OpenBench is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# OpenBench is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
import math, requests, random
from django.utils import timezone
@@ -61,12 +81,12 @@ def newTest(request):
# Extract Development Fields
devname = request.POST['devbranch']
devbench = int(request.POST['devbench'])
devprotocol = FRAMEWORK_DEFAULTS['config']['engines'][test.engine]['proto']
devprotocol = OPENBENCH_CONFIG['engines'][test.engine]['proto']
# Extract Base Fields
basename = request.POST['basebranch']
basebench = int(request.POST['basebench'])
baseprotocol = FRAMEWORK_DEFAULTS['config']['engines'][test.engine]['proto']
baseprotocol = OPENBENCH_CONFIG['engines'][test.engine]['proto']
# Extract test configuration
test.source = request.POST['source']
@@ -206,8 +226,8 @@ def workloadDictionary(machine, result, test):
'result' : { 'id' : result.id, },
'test' : {
'id' : test.id,
'nps' : FRAMEWORK_DEFAULTS['config']['engines'][test.engine]['nps'],
'book' : FRAMEWORK_DEFAULTS['config']['books'][test.bookname],
'nps' : OPENBENCH_CONFIG['engines'][test.engine]['nps'],
'book' : OPENBENCH_CONFIG['books'][test.bookname],
'timecontrol' : test.timecontrol,
'engine' : test.engine,
'dev' : {
+80 -47
View File
@@ -1,12 +1,32 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# OpenBench is a chess engine testing framework authored by Andrew Grant. #
# <https://github.com/AndyGrant/OpenBench> <andrew@grantnet.us> #
# #
# OpenBench is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# OpenBench is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#from django.shortcuts import render as djangoRender
import django.shortcuts
import django.contrib.auth
from django.db.models import F
from django.shortcuts import render as djangoRender
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate
from django.contrib.auth import login as loginUser
from django.contrib.auth import logout as logoutUser
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.contrib.admin.views.decorators import staff_member_required
from django.views.decorators.csrf import csrf_exempt
from django.utils.timezone import utc
from htmlmin.decorators import not_minified_response
@@ -18,71 +38,83 @@ from OpenBench.utils import pagingContext
import OpenBench.utils, datetime
def render(request, template, data):
def render(request, template, data={}):
# Always provde the Configuration
data.update(FRAMEWORK_DEFAULTS)
# Send User data when logged in
# Provide Configuration & User information
data.update({'config' : OPENBENCH_CONFIG})
if request.user.is_authenticated:
data.update({'profile' : Profile.objects.get(user=request.user)})
# Final wrap of Django's rendering funtion
return djangoRender(request, 'OpenBench/{0}'.format(template), data)
# Wrapper to simplify django's rendering function
return django.shortcuts.render(request, 'OpenBench/{0}'.format(template), data)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Administrative Views #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# GET : #
# #
# POST : #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def register(request):
# User trying to view the registration page
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# GET : Return the HTML template used for registering a new User #
# #
# POST : Enforce matching alpha-numeric passwords, and then attempt to #
# generate a new User and Profile. Return to the homepage after #
# after logging the User in. Share any errors with the viewer #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if request.method == 'GET':
return render(request, 'register.html', {})
return render(request, 'register.html')
try:
# Verify that the passwords are matching
if request.POST['password1'] != request.POST['password2']:
raise Exception('Passwords Do Not Match')
if request.POST['password1'] != request.POST['password2']:
return index(request, error='Passwords Do Not Match')
# Force alpha numeric usernames
if not request.POST['username'].isalnum():
raise Exception('Alpha Numeric Usernames Only')
if not request.POST['username'].isalnum():
return index(request, error='Alpha Numeric Usernames Only')
# Create new User and Profile
Profile.objects.create(
user=User.objects.create_user(
request.POST['username'],
request.POST['email'],
request.POST['password1']))
if User.objects.filter(username=request.POST['username']):
return index(request, error='That Username is taken')
# Log the User in now
loginUser(request, User.objects.get(username=request.POST['username']))
# Kick back to index
return HttpResponseRedirect('/index/')
email = request.POST['email']
username = request.POST['username']
password = request.POST['password1']
# Bad data, kick back to index with error
except Exception as error:
return index(request, error=str(error))
user = User.objects.create_user(username, email, password)
Profile.objects.create(user=user)
django.contrib.auth.login(request, user)
return HttpResponseRedirect('/index/')
def login(request):
# User trying to view the login page
if request.method == 'GET':
return render(request, 'login.html', {})
return render(request, 'login.html')
try:
# Attempt to login the user, and return to index
loginUser(request, authenticate(
username=request.POST['username'],
password=request.POST['password']))
django.contrib.auth.login(request,
django.contrib.auth.authenticate(
username=request.POST['username'],
password=request.POST['password']))
return HttpResponseRedirect('/index/')
# Bad data, kick back to index with error
except Exception as error:
return index(request, error='Invalid Login Credentials')
return index(request, error='Unable to Authenticate User')
def logout(request):
# Logout the user and return to index
logoutUser(request)
django.contrib.auth.logout(request)
return HttpResponseRedirect('/index/')
@login_required(login_url='/login/')
@@ -115,6 +147,8 @@ def editProfile(request):
# Send back to see the homepage
return HttpResponseRedirect('/index/')
def index(request, page=1, pageLength=24, greens=False, username=None, error=''):
# Get tests pending approval
@@ -259,7 +293,7 @@ def machines(request):
data = {'machines' : Machine.objects.filter(updated__gte=target)}
return render(request, 'machines.html', data)
def eventLog(request, page=1, pageLength=50):
def eventLog(request, page=1, pageLength=24):
# Choose events within the given page, if any
events = LogEvent.objects.all().order_by('-id')
@@ -477,8 +511,7 @@ def deleteTest(request, id):
def getFiles(request):
# Core Files should be sitting in framework's repo
source = FRAMEWORK_REPO_URL + 'raw/master/CoreFiles/'
return HttpResponse(source)
return HttpResponse(OPENBENCH_CONFIG['corefiles'])
@csrf_exempt
@not_minified_response
+2 -2
View File
@@ -54,15 +54,15 @@
<ul>
<li class="header">INFO</li>
<li><a href="/users">Users</a></li>
<li><a href="/eventLog">Events</a></li>
<li><a href="/machines">Machines</a></li>
<li><a href="/eventLog">EventLog</a></li>
<li><a href="{{config.framework}}">OpenBench</a></li>
</ul>
<ul>
<li class="header">ENGINES</li>
{% for engine, data in config.engines.items|dictsort:"0.lower" %}
<li><a href="{{data.source}}">{{data.name}}</a></li>
<li><a href="{{data.source}}">{{engine}}</a></li>
{% endfor %}
</ul>
+7 -5
View File
@@ -2,13 +2,14 @@
{% block content %}
<table class="rawtable">
<table>
<tr>
<th>Date</th>
<th>User</th>
<th>Test</th>
<th>Action</th>
<th>DATE</th>
<th>USER</th>
<th>TEST</th>
<th>TIME</th>
<th>ACTION</th>
</tr>
{% for event in events %}
@@ -16,6 +17,7 @@
<td>{{event.creation|date:'Y-m-d H:i:s'}}</td>
<td>{{event.author}}</td>
<td><a href="/viewTest/{{event.test.id}}">{{event.test.dev.name}}</a></td>
<td>{{event.test.timecontrol}}</td>
<td>{{event.data}}</td>
</tr>
{% endfor %}
+14 -12
View File
@@ -8,25 +8,27 @@
{% if paging.page == 1 and greens == False %}
<!-- Currently Pending tests (Waiting to be approved) -->
<tr><td class="embedded" colspan='6'><h2>Pending</h2></td></tr>
{% for test in pending %}
{% include "OpenBench/Blocks/testsummary.html" %}
{% endfor %}
<!-- Show Worker information when running a test -->
{% if active %}
<tr><td class="embedded" colspan='6'><h2>Active {{status}}</h2></td></tr>
{% if pending %}
<tr><th colspan='6'>Pending</th></tr>
{% for test in pending %}
{% include "OpenBench/Blocks/testsummary.html" %}
{% endfor %}
<tr class="table-spacer"><th></th></tr>
{% endif %}
<!-- Currently Running tests (Waiting to be completed) -->
{% for test in active %}
{% include "OpenBench/Blocks/testsummary.html" %}
{% endfor %}
{% if active %}
<tr><th colspan='6'>Active {{status}}</th></tr>
{% for test in active %}
{% include "OpenBench/Blocks/testsummary.html" %}
{% endfor %}
<tr class="table-spacer"><th></th></tr>
{% endif %}
{% endif %}
<!-- Tests which have already finished -->
<tr><td class="embedded" colspan='6'><h2>Finished</h2></td></tr>
<tr><th colspan='6'>Finished</th></tr>
{% for test in completed %}
{% include "OpenBench/Blocks/testsummary.html" %}
{% endfor %}
+7 -7
View File
@@ -1,18 +1,18 @@
{% extends "OpenBench/base.html" %}
{% load mytags %} <!-- For twoDigitPrecision() -->
{% load mytags %}
{% block content %}
<table class="rawtable">
<table>
<tr>
<th>ID</th>
<th>User</th>
<th>System</th>
<th>Updated</th>
<th>Workload</th>
<th>Threads</th>
<th>USER</th>
<th>SYSTEM</th>
<th>UPDATED</th>
<th>WORKLOAD</th>
<th>THREADS</th>
<th>MNPS</th>
</tr>
+2 -2
View File
@@ -75,9 +75,9 @@
<label> Book </label> <select name="bookname">
{% for name, data in config.books.items %}
{% if data.default %}
<option selected value="{{name}}">{{data.name}}</option>
<option selected value="{{name}}">{{name}}</option>
{% else %}
<option value="{{name}}">{{data.name}}</option>
<option value="{{name}}">{{name}}</option>
{% endif %}
{% endfor %}
</select><br>
+16 -20
View File
@@ -1,42 +1,38 @@
{% extends "OpenBench/base.html" %}
{% load mytags %} <!-- For sumAttributes() & insertCommas() -->
{% load mytags %}
{% block content %}
<table class="summarytable">
<tr>
<th class="numeric"> OVERALL </th>
<th class="numeric">| USERS {{ profiles|length }} </th>
<th class="numeric">| TESTS {{ profiles|sumAttributes:"tests"|insertCommas }}</th>
<th class="numeric">| GAMES {{ profiles|sumAttributes:"games"|insertCommas }}</th>
</tr>
</table>
<table class="rawtable">
<table>
<tr>
<th>Username</th>
<th>Last Seen</th>
<th class="numeric">Games</th>
<th class="numeric">Tests</th>
<th>Engine</th>
<th>Source Repository</th>
<th>USERNAME</th>
<th>GAMES</th>
<th>TESTS</th>
<th>ENGINE</th>
<th>SOURCE REPOSITORY</th>
</tr>
{% for profile in profiles %}
{% if profile.enabled %}
<tr>
<td><a href="/viewUser/{{profile.user.username}}">{{profile.user.username}}</a></td>
<td>{{profile.updated|date:'Y-m-d'}}</td>
<td class="numeric">{{profile.games}}</td>
<td class="numeric">{{profile.tests}}</td>
<td style="text-align: right">{{profile.games|insertCommas}}</td>
<td style="text-align: right">{{profile.tests|insertCommas}}</td>
<td>{{profile.engine}}</td>
<td><a href="{{profile.repo}}">{{profile.repo}}</a></td>
</tr>
{% endif %}
{% endfor %}
<tr style="font-weight: bold">
<th>OVERALL</th>
<th>{{profiles|sumAttributes:"games"|insertCommas}}</th>
<th>{{profiles|sumAttributes:"tests"|insertCommas}}</th>
<th></th><th></th>
</tr>
</table>
{% endblock %}
+32 -30
View File
@@ -9,25 +9,23 @@
{% block content %}
<div id="configuration">
<table class="rawtable">
<tr><td>Engine</td><td>{{test.engine}}</td></tr>
<tr><td>Dev Branch</td><td>{{test.dev.name}}</td></tr>
<tr><td>Dev Bench</td><td>{{test.dev.bench}}</td></tr>
<tr><td>Dev Options</td><td>{{test.devoptions}}</td></tr>
<tr><td>Dev Protocol</td><td>{{test.dev.protocol}}</td></tr>
<tr><td>Dev Sha</td><td>{{test.dev.sha}}</td></tr>
<tr><td>Base Branch</td><td>{{test.base.name}}</td></tr>
<tr><td>Base Bench</td><td>{{test.base.bench}}</td></tr>
<tr><td>Base Options</td><td>{{test.baseoptions}}</td></tr>
<tr><td>Base Protocol</td><td>{{test.base.protocol}}</td></tr>
<tr><td>Base Sha</td><td>{{test.base.sha}}</td></tr>
<tr><td>Source Repo</td><td>{{test.source}}</td></tr>
<tr><td>Opening Book</td><td>{{test.bookname}}</td></tr>
<tr><td>Time Control</td><td>{{test.timecontrol}}s</td></tr>
<tr><td>Elo Bounds</td><td>[{{test.elolower}}, {{test.eloupper}}]</td></tr>
<tr><td>SPRT Bounds</td><td>({{test.lowerllr|twoDigitPrecision}}, {{test.upperllr|twoDigitPrecision}})</td></tr>
<tr><td>Creation</td><td>{{test.creation|date:'Y-m-d H:i:s'}}</td></tr>
<tr><td>Author</td><td>{{test.author}}</td></tr>
<table class="datatable left-align">
<tr><th>Engine</th><td>{{test.engine}}</td></tr>
<tr><th>Dev Branch</th><td>{{test.dev.name}}</td></tr>
<tr><th>Dev Bench</th><td>{{test.dev.bench}}</td></tr>
<tr><th>Dev Options</th><td>{{test.devoptions}}</td></tr>
<tr><th>Dev Sha</th><td>{{test.dev.sha}}</td></tr>
<tr><th>Base Branch</th><td>{{test.base.name}}</td></tr>
<tr><th>Base Bench</th><td>{{test.base.bench}}</td></tr>
<tr><th>Base Options</th><td>{{test.baseoptions}}</td></tr>
<tr><th>Base Sha</th><td>{{test.base.sha}}</td></tr>
<tr><th>Source Repo</th><td>{{test.source}}</td></tr>
<tr><th>Opening Book</th><td>{{test.bookname}}</td></tr>
<tr><th>Time Control</th><td>{{test.timecontrol}}s</td></tr>
<tr><th>Elo Bounds</th><td>[{{test.elolower}}, {{test.eloupper}}]</td></tr>
<tr><th>SPRT Bounds</th><td>({{test.lowerllr|twoDigitPrecision}}, {{test.upperllr|twoDigitPrecision}})</td></tr>
<tr><th>Creation</th><td>{{test.creation|date:'Y-m-d H:i:s'}}</td></tr>
<tr><th>Author</th><td>{{test.author}}</td></tr>
</table>
</div>
@@ -77,16 +75,20 @@
<!-- ELO, SPRT, LLR, Games -->
<pre>{{test|longStatBlock|linebreaksbr}}</pre>
<!-- Forum to modify the Priority or Throughput -->
<form method="POST" action="/editTest/{{test.id}}/">
{% csrf_token %}
<label>Priority</label><input value="{{test.priority}}" name="priority"><br>
<label>Throughput</label><input value="{{test.throughput}}" name="throughput"><br>
<!-- Edit Button: For Approvers or Test Authors -->
{% if profile.approver or profile.user.username == test.author %}
<input type="submit" name="submit" value="Modify">
<input type="submit" name="submit" value="Modify">
{% else %}
<input class="deadbutton" type="submit" name="submit" value="Modify">
<input class="deadbutton" type="submit" name="submit" value="Modify">
{% endif %}
</form>
@@ -101,21 +103,21 @@
<tr>
<th>ID</th>
<th>Owner</th>
<th>System</th>
<th>USER</th>
<th>OS</th>
<th>Last Updated</th>
<th style="width: 60px">Games</th>
<th style="width: 60px">Won</th>
<th style="width: 60px">Lost</th>
<th style="width: 60px">Drawn</th>
<th style="width: 60px">Time</th>
<th style="width: 60px">Crash</th>
<th style="width: 60px">GAMES</th>
<th style="width: 60px">WON</th>
<th style="width: 60px">LOST</th>
<th style="width: 60px">DRAWN</th>
<th style="width: 60px">TIME</th>
<th style="width: 60px">CRASH</th>
</tr>
{% for result in results %}
<tr>
<td>{{result.machine.id}}</td>
<td>{{result.machine.owner}}</td>
<td>{{result.machine.owner|slice:"6"}}</td>
<td>{{result.machine.osname|truncatewords:1|slice:":-4"}}</td>
<td>{{result.updated|date:'Y-m-d H:i'}}</td>
<td class="numeric">{{result.games}}</td>