Merge tune.html and test.html into workload.html

Always show a network, even if it is blank due to a non NNUE engine
Redirect test/tune searches where the names are swapped
This commit is contained in:
andrew committed 2024-01-10 20:13:44 -05:00
1 parent 003148abbe
commit f1626daad9
6 files changed
+277 -385

No files matched your search

+4
View File
@@ -260,6 +260,9 @@ def spsa_param_digest(workload):
return digest
def spsa_param_digest_headers(workload):
return ['Name', 'Curr', 'Start', 'Min', 'Max', 'C', 'C_end', 'R', 'R_end']
def spsa_original_input(workload):
# Maintain the original order, if there was one
@@ -366,6 +369,7 @@ def test_is_fischer(test):
register.filter('spsa_param_digest', spsa_param_digest)
register.filter('spsa_param_digest_headers', spsa_param_digest_headers)
register.filter('spsa_original_input', spsa_original_input)
register.filter('spsa_optimal_values', spsa_optimal_values)
+7 -10
View File
@@ -27,10 +27,11 @@ import django.contrib.auth
import OpenBench.config
import OpenBench.utils
from OpenBench.workloads.get_workload import get_workload
from OpenBench.workloads.create_workload import create_workload
from OpenBench.workloads.verify_workload import verify_workload
from OpenBench.workloads.get_workload import get_workload
from OpenBench.workloads.modify_workload import modify_workload
from OpenBench.workloads.verify_workload import verify_workload
from OpenBench.workloads.view_workload import view_workload
from OpenBench.config import OPENBENCH_CONFIG
from OpenSite.settings import PROJECT_PATH
@@ -464,11 +465,9 @@ def test(request, id, action=None):
# Verify that it is indeed a Test and not a Tune
if test.test_mode != 'SPRT' and test.test_mode != 'GAMES':
return redirect(request, '/index/', error='You are trying to view a Tune not Test')
return redirect(request, '/tune/%d' % (id))
# Package everything up and display the test
data = { 'test' : test, 'results': Result.objects.filter(test=test) }
return render(request, 'test.html', data)
return view_workload(request, test, 'TEST')
def tune(request, id, action=None):
@@ -482,11 +481,9 @@ def tune(request, id, action=None):
# Verify that it is indeed a Tune and not a Test
if tune.test_mode == 'SPRT' or tune.test_mode == 'GAMES':
return redirect(request, '/index/', error='You are trying to view a Test not Tune')
return redirect(request, '/test/%d' % (id))
# Package everything up and display the Tune
data = { 'test' : tune, 'results': Result.objects.filter(test=tune) }
return render(request, 'tune.html', data)
return view_workload(request, tune, 'TUNE')
def create_test(request):
return create_workload(request, 'TEST')
+50
View File
@@ -0,0 +1,50 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# 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/>. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Module serves a singular purpose, to invoke:
# >>> view_workload(request, workload, type)
#
# A Workload can be a "TEST", which is an SPRT, or FIXED type.
# A Workload can be a "TUNE", which is an SPSA tuning session
import OpenBench.views
from OpenBench.models import *
def view_workload(request, workload, workload_type):
assert workload_type in [ 'TEST', 'TUNE' ]
data = {
'workload' : workload,
'results' : Result.objects.filter(test=workload)
}
if workload_type == 'TEST':
data['type'] = workload_type
data['dev_text'] = 'Dev'
data['submit_endpoint'] = '/newTest/'
if workload_type == 'TUNE':
data['type'] = workload_type
data['dev_text'] = ''
data['submit_endpoint'] = '/newTune/'
return OpenBench.views.render(request, 'workload.html', data)