Fix regex expressions; should not impact old clients
This commit is contained in:
1 parent
a10a3369ee
commit
fa1f189cac
2 files changed
+18
-9
No files matched your search
+9
-5
@@ -278,18 +278,22 @@ def run_bench(engine, outqueue):
|
|||||||
def scale_time_control(workload, nps):
|
def scale_time_control(workload, nps):
|
||||||
|
|
||||||
# Searching for X/Y+Z time controls
|
# Searching for X/Y+Z time controls
|
||||||
pattern = '(\d*.\d*)/?(\d+)?\+?(\d*.\d*)?'
|
pattern = '(?P<base>\d*(\.\d+)?)(?P<rep>/\d+)?(?P<inc>\+\d+\.\d+)?'
|
||||||
time_control = workload['test']['timecontrol']
|
results = re.search(pattern, workload['test']['timecontrol'])
|
||||||
base, repeat, inc = re.search(pattern, time_control).groups(0)
|
base, rep, inc = results.group('base', 'rep', 'inc')
|
||||||
|
|
||||||
|
# Strip any leading / or + symbols
|
||||||
|
rep = None if rep is None else rep[1:]
|
||||||
|
inc = '0' if inc is None else inc[1:]
|
||||||
|
|
||||||
# Scale our machine's NPS to the Server's NPS
|
# Scale our machine's NPS to the Server's NPS
|
||||||
base = float(base) * int(workload['test']['nps']) / nps
|
base = float(base) * int(workload['test']['nps']) / nps
|
||||||
inc = float(inc ) * int(workload['test']['nps']) / nps
|
inc = float(inc ) * int(workload['test']['nps']) / nps
|
||||||
|
|
||||||
# Only include repeating controls when found
|
# Only include repeating controls when found
|
||||||
if repeat == 0:
|
if rep is None:
|
||||||
return '%.2f+%.2f' % (base, inc)
|
return '%.2f+%.2f' % (base, inc)
|
||||||
return ('%.2f/%d+%.2f' % (base, int(repeat), inc))
|
return '%.2f/%d+%.2f' % (base, int(rep), inc)
|
||||||
|
|
||||||
def kill_cutechess(cutechess):
|
def kill_cutechess(cutechess):
|
||||||
|
|
||||||
|
|||||||
+9
-4
@@ -49,13 +49,18 @@ def extractOption(options, option):
|
|||||||
def parseTimeControl(timecontrol):
|
def parseTimeControl(timecontrol):
|
||||||
|
|
||||||
# Searching for X/Y+Z time controls
|
# Searching for X/Y+Z time controls
|
||||||
pattern = '(\d*.\d*)/?(\d+)?\+?(\d*.\d*)?'
|
pattern = '(?P<base>\d*(\.\d+)?)(?P<rep>/\d+)?(?P<inc>\+\d+\.\d+)?'
|
||||||
base, repeat, inc = re.search(pattern, timecontrol).groups(0)
|
results = re.search(pattern, timecontrol)
|
||||||
|
base, rep, inc = results.group('base', 'rep', 'inc')
|
||||||
|
|
||||||
|
# Strip any leading / or + symbols
|
||||||
|
rep = None if rep is None else rep[1:]
|
||||||
|
inc = '0' if inc is None else inc[1:]
|
||||||
|
|
||||||
# Only include repeating controls when found
|
# Only include repeating controls when found
|
||||||
if repeat == 0:
|
if rep is None:
|
||||||
return '%.1f+%.2f' % (float(base), float(inc))
|
return '%.1f+%.2f' % (float(base), float(inc))
|
||||||
return '%.1f/%d+%.2f' % (float(base), int(repeat), float(inc))
|
return '%.1f/%d+%.2f' % (float(base), int(rep), float(inc))
|
||||||
|
|
||||||
|
|
||||||
def getPendingTests():
|
def getPendingTests():
|
||||||
|
|||||||
Reference in new issue
Block a user