diff --git a/Client/Client.py b/Client/Client.py index 38c015b..5df2b58 100644 --- a/Client/Client.py +++ b/Client/Client.py @@ -49,7 +49,7 @@ from itertools import combinations_with_replacement TIMEOUT_HTTP = 30 # Timeout in seconds for HTTP requests TIMEOUT_ERROR = 10 # Timeout in seconds when any errors are thrown TIMEOUT_WORKLOAD = 30 # Timeout in seconds between workload requests -CLIENT_VERSION = '1' # Client version to send to the Server +CLIENT_VERSION = '2' # Client version to send to the Server SYZYGY_WDL_PATH = None # Pathway to WDL Syzygy Tables BASE_GAMES_PER_CORE = 16 # Typical games played per-thread @@ -272,22 +272,21 @@ def run_bench(engine, outqueue): def scale_time_control(workload, nps): # Searching for X/Y+Z time controls - pattern = '(?P\d*(\.\d+)?)(?P/\d+)?(?P\+\d+\.\d+)?' + pattern = '(?P(\d+/)?)(?P\d*(\.\d+)?)(?P\+(\d+\.)?\d+)?' results = re.search(pattern, workload['test']['timecontrol']) - base, rep, inc = results.group('base', 'rep', 'inc') + moves, base, inc = results.group('moves', 'base', 'inc') - # Strip any leading / or + symbols - rep = None if rep is None else rep[1:] - inc = '0' if inc is None else inc[1:] + # Strip the trailing and leading symbols + moves = None if moves == '' else moves.rstrip('/') + inc = 0.0 if inc is None else inc.lstrip('+') - # Scale our machine's NPS to the Server's NPS + # Scale the time based on this machines NPS base = float(base) * int(workload['test']['nps']) / nps inc = float(inc ) * int(workload['test']['nps']) / nps - # Only include repeating controls when found - if rep is None: - return '%.2f+%.2f' % (base, inc) - return '%.2f/%d+%.2f' % (base, int(rep), inc) + # Format the time control for cutechess + if moves is None: return '%.2f+%.2f' % (base, inc) + return '%d/%.2f+%.2f' % (int(moves), base, inc) def kill_cutechess(cutechess): diff --git a/OpenBench/config.py b/OpenBench/config.py index b338c09..6137df2 100644 --- a/OpenBench/config.py +++ b/OpenBench/config.py @@ -23,7 +23,7 @@ USE_CROSS_APPROVAL = False OPENBENCH_CONFIG = { # Server Client version control - 'client_version' : '1', + 'client_version' : '2', # Generic Error Messages useful to those setting up their own instance 'error' : { diff --git a/OpenBench/utils.py b/OpenBench/utils.py index b671aa5..58bd915 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -46,21 +46,20 @@ def extractOption(options, option): match = re.search('(?<={0}=)[^ ]*'.format(option), options) if match: return match.group() -def parseTimeControl(timecontrol): +def parseTimeControl(time_control): # Searching for X/Y+Z time controls - pattern = '(?P\d*(\.\d+)?)(?P/\d+)?(?P\+\d+\.\d+)?' - results = re.search(pattern, timecontrol) - base, rep, inc = results.group('base', 'rep', 'inc') + pattern = '(?P(\d+/)?)(?P\d*(\.\d+)?)(?P\+(\d+\.)?\d+)?' + results = re.search(pattern, time_control) + moves, base, inc = results.group('moves', 'base', 'inc') - # Strip any leading / or + symbols - rep = None if rep is None else rep[1:] - inc = '0' if inc is None else inc[1:] + # Strip the trailing and leading symbols + moves = None if moves == '' else moves.rstrip('/') + inc = 0.0 if inc is None else inc.lstrip('+') - # Only include repeating controls when found - if rep is None: - return '%.1f+%.2f' % (float(base), float(inc)) - return '%.1f/%d+%.2f' % (float(base), int(rep), float(inc)) + # Format the time control for cutechess + if moves is None: return '%.1f+%.2f' % (float(base), float(inc)) + return '%d/%.1f+%.2f' % (int(moves), float(base), float(inc)) def getPendingTests(): diff --git a/OpenBench/views.py b/OpenBench/views.py index e88709e..4090be4 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -624,11 +624,6 @@ def clientGetWorkload(request): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - # HACK: Make Noobpwnftw's workers jump around - # if request.POST['username'] == 'WorkerPool': - # N = len(set([x.engine for x in OpenBench.utils.getActiveTests()])) - # if random.randrange(1 + N) == 0: return HttpResponse('None') - # Verify the User's credentials try: user = authenticate(request, True) except UnableToAuthenticate: return HttpResponse('Bad Credentials')