From 9faa5c51aa2f3aae19a3b5dc0487f92902ce95d0 Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 6 Jun 2023 05:32:22 -0400 Subject: [PATCH] Bugfix cross-engine, and time control parsing --- Client/Client.py | 4 ++-- OpenBench/utils.py | 12 ++++++------ Templates/OpenBench/Blocks/testsummary.html | 5 +---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Client/Client.py b/Client/Client.py index 33f4ae7..5cf3517 100644 --- a/Client/Client.py +++ b/Client/Client.py @@ -896,7 +896,7 @@ def run_benchmarks(arguments, workload, branch, engine, network): if private and network: args.append(network) multiprocessing.Process(target=run_bench, args=args).start() - nps, bench = list(zip(*[queue.get() for ii in range(cores)])) + bench, nps = list(zip(*[queue.get() for ii in range(cores)])) if len(set(bench)) > 1: return (0, 0) # Flag an error print('Bench for %s is %d' % (name, bench[0])) @@ -916,7 +916,7 @@ def build_cutechess_command(arguments, workload, dev_cmd, base_cmd, nps, cuteche dev_threads = int(re.search('(?<=Threads=)\d*', dev_options ).group()) base_threads = int(re.search('(?<=Threads=)\d*', base_options).group()) - dev_network = workload['test']['base']['network'] # Could be empty strings + dev_network = workload['test']['dev' ]['network'] # Could be empty strings base_network = workload['test']['base']['network'] # Could be empty strings dev_time = scale_time_control(workload, nps, 'dev') diff --git a/OpenBench/utils.py b/OpenBench/utils.py index eb664b6..96c3536 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -46,7 +46,7 @@ def extract_option(options, option): match = re.search('(?<={0}=)[^ ]*'.format(option), options) if match: return match.group() -def parse_time_control(timecontrol): +def parse_time_control(time_control): # Display Nodes as N=, Depth as D=, MoveTime as MT= conversion = { @@ -57,13 +57,13 @@ def parse_time_control(timecontrol): # Searching for "nodes=", "depth=", and "movetime=" Time Controls pattern = '(?P((N)|(D)|(MT)|(nodes)|(depth)|(movetime)))=(?P(\d+))' - if results := re.search(pattern, timecontrol.upper()): + if results := re.search(pattern, time_control.upper()): mode, value = results.group('mode', 'value') return '%s=%s' % (conversion[mode], value) # Searching for "X/Y+Z" time controls pattern = '(?P(\d+/)?)(?P\d*(\.\d+)?)(?P\+(\d+\.)?\d+)?' - if results := re.search(pattern, timecontrol): + if results := re.search(pattern, time_control): moves, base, inc = results.group('moves', 'base', 'inc') # Strip the trailing and leading symbols @@ -74,7 +74,7 @@ def parse_time_control(timecontrol): if moves is None: return '%.1f+%.2f' % (float(base), float(inc)) return '%d/%.1f+%.2f' % (int(moves), float(base), float(inc)) - raise Exception('Unable to parse Time Control (%s)' % (timecontrol)) + raise Exception('Unable to parse Time Control (%s)' % (time_control)) def get_pending_tests(): @@ -422,14 +422,14 @@ def create_new_test(request): test.dev_engine = request.POST['dev_engine'] test.dev_options = request.POST['dev_options'] test.dev_network = request.POST['dev_network'] - test.dev_time_control = request.POST['dev_time_control'] + test.dev_time_control = parse_time_control(request.POST['dev_time_control']) test.base = getEngine(*baseinfo) test.base_repo = request.POST['base_repo'] test.base_engine = request.POST['base_engine'] test.base_options = request.POST['base_options'] test.base_network = request.POST['base_network'] - test.base_time_control = request.POST['base_time_control'] + test.base_time_control = parse_time_control(request.POST['base_time_control']) test.report_rate = int(request.POST['report_rate']) test.workload_size = int(request.POST['workload_size']) diff --git a/Templates/OpenBench/Blocks/testsummary.html b/Templates/OpenBench/Blocks/testsummary.html index d10048e..ee7dcc8 100644 --- a/Templates/OpenBench/Blocks/testsummary.html +++ b/Templates/OpenBench/Blocks/testsummary.html @@ -1,10 +1,7 @@ {% load mytags %} {{test.author|capfirst|slice:":6"}} - - {{test.dev_engine}} - {% if test.dev_engine != test.base_engine %} * {% endif %} - + {{test.dev_engine}} {{test|prettyDevName}} {% if test.error %} * {% endif %}