Bugfix cross-engine, and time control parsing

This commit is contained in:
andrew committed 2023-06-06 05:32:22 -04:00
1 parent 01d99a86df
commit 9faa5c51aa
3 files changed
+9 -12

No files matched your search

+2 -2
View File
@@ -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')
+6 -6
View File
@@ -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<mode>((N)|(D)|(MT)|(nodes)|(depth)|(movetime)))=(?P<value>(\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<moves>(\d+/)?)(?P<base>\d*(\.\d+)?)(?P<inc>\+(\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'])
+1 -4
View File
@@ -1,10 +1,7 @@
{% load mytags %}
<tr>
<td><a href="/user/{{test.author}}">{{test.author|capfirst|slice:":6"}}</a></td>
<td>
{{test.dev_engine}}
{% if test.dev_engine != test.base_engine %} <span style="color: yellow">*</span> {% endif %}
</td>
<td>{{test.dev_engine}}</td>
<td>
<a href="/test/{{test.id}}">{{test|prettyDevName}}</a>
{% if test.error %} <span style="color: red">*</span> {% endif %}