Include dev+base NPS, send private field cleanly, more Client refactoring
This commit is contained in:
1 parent
824de3e0b5
commit
5d1d703dfa
4 files changed
+111
-103
No files matched your search
+95
-94
@@ -41,10 +41,10 @@ from itertools import combinations_with_replacement
|
|||||||
|
|
||||||
## Basic configuration of the Client. These timeouts can be changed at will
|
## Basic configuration of the Client. These timeouts can be changed at will
|
||||||
|
|
||||||
TIMEOUT_HTTP = 30 # Timeout in seconds for HTTP requests
|
TIMEOUT_HTTP = 30 # Timeout in seconds for HTTP requests
|
||||||
TIMEOUT_ERROR = 10 # Timeout in seconds when any errors are thrown
|
TIMEOUT_ERROR = 10 # Timeout in seconds when any errors are thrown
|
||||||
TIMEOUT_WORKLOAD = 30 # Timeout in seconds between workload requests
|
TIMEOUT_WORKLOAD = 30 # Timeout in seconds between workload requests
|
||||||
CLIENT_VERSION = '9' # Client version to send to the Server
|
CLIENT_VERSION = '10' # Client version to send to the Server
|
||||||
|
|
||||||
## Global information which is shared by all helper threads for ease of use
|
## Global information which is shared by all helper threads for ease of use
|
||||||
|
|
||||||
@@ -210,14 +210,10 @@ class Configuration(object):
|
|||||||
|
|
||||||
class ServerReporter(object):
|
class ServerReporter(object):
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def append_credentials(config, payload):
|
|
||||||
payload['machine_id'] = config.machine_id
|
|
||||||
payload['secret_token'] = config.secret_token
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def report(config, endpoint, payload):
|
def report(config, endpoint, payload):
|
||||||
append_credentials(config, payload)
|
payload['machine_id'] = config.machine_id
|
||||||
|
payload['secret'] = config.secret_token
|
||||||
target = url_join(config.server, endpoint)
|
target = url_join(config.server, endpoint)
|
||||||
return requests.post(target, data=payload, timeout=TIMEOUT_HTTP)
|
return requests.post(target, data=payload, timeout=TIMEOUT_HTTP)
|
||||||
|
|
||||||
@@ -233,10 +229,10 @@ class ServerReporter(object):
|
|||||||
return ServerReporter.report(config, 'clientSubmitNPS', payload)
|
return ServerReporter.report(config, 'clientSubmitNPS', payload)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def report_missing_artifact(config, workload, artifact_name, artifact_json):
|
def report_missing_artifact(config, artifact_name, artifact_json):
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
'test_id' : workload['test']['id'],
|
'test_id' : config.workload['test']['id'],
|
||||||
'error' : 'Artifact %s missing' % (artifact_name),
|
'error' : 'Artifact %s missing' % (artifact_name),
|
||||||
'logs' : json.dumps(artifact_json, indent=2),
|
'logs' : json.dumps(artifact_json, indent=2),
|
||||||
}
|
}
|
||||||
@@ -244,14 +240,14 @@ class ServerReporter(object):
|
|||||||
return ServerReporter.report(config, 'clientSubmitError', payload)
|
return ServerReporter.report(config, 'clientSubmitError', payload)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def report_build_fail(config, workload, branch, output):
|
def report_build_fail(config, branch, output):
|
||||||
|
|
||||||
branch_name = workload['test'][branch]['name']
|
branch_name = config.workload['test'][branch]['name']
|
||||||
engine_name = workload['test'][branch]['engine']
|
engine_name = config.workload['test'][branch]['engine']
|
||||||
final_name = '[%s] %s' % (engine_name, branch_name)
|
final_name = '[%s] %s' % (engine_name, branch_name)
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
'test_id' : workload['test']['id'],
|
'test_id' : config.workload['test']['id'],
|
||||||
'error' : '%s build failed' % (final_name),
|
'error' : '%s build failed' % (final_name),
|
||||||
'logs' : compiler_output,
|
'logs' : compiler_output,
|
||||||
}
|
}
|
||||||
@@ -259,7 +255,7 @@ class ServerReporter(object):
|
|||||||
return ServerReporter.report(config, 'clientSubmitError', payload)
|
return ServerReporter.report(config, 'clientSubmitError', payload)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def report_engine_error(config, workload, cutechess_str, pgn):
|
def report_engine_error(config, cutechess_str, pgn):
|
||||||
|
|
||||||
white, black = cutechess_str.split('(')[1].split(')')[0].split(' vs ')
|
white, black = cutechess_str.split('(')[1].split(')')[0].split(' vs ')
|
||||||
|
|
||||||
@@ -268,7 +264,7 @@ class ServerReporter(object):
|
|||||||
error = error.replace('Black', '-'.join(black.split('-')[1:]).rstrip())
|
error = error.replace('Black', '-'.join(black.split('-')[1:]).rstrip())
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
'test_id' : workload['test']['id'],
|
'test_id' : config.workload['test']['id'],
|
||||||
'error' : error,
|
'error' : error,
|
||||||
'logs' : pgn,
|
'logs' : pgn,
|
||||||
}
|
}
|
||||||
@@ -276,25 +272,25 @@ class ServerReporter(object):
|
|||||||
return ServerReporter.report(config, 'clientSubmitError', payload)
|
return ServerReporter.report(config, 'clientSubmitError', payload)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def report_bad_bench(config, workload, branch, bench):
|
def report_bad_bench(config, branch, bench):
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
'test_id' : workload['test']['id'],
|
'test_id' : config.workload['test']['id'],
|
||||||
'engine' : workload['test'][branch]['name'],
|
'engine' : config.workload['test'][branch]['name'],
|
||||||
'correct' : workload['test'][branch]['bench'],
|
'correct' : config.workload['test'][branch]['bench'],
|
||||||
'wrong' : bench,
|
'wrong' : bench,
|
||||||
}
|
}
|
||||||
|
|
||||||
return ServerReporter.report(config, 'clientWrongBench', payload)
|
return ServerReporter.report(config, 'clientWrongBench', payload)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def report_results(config, workload, stats):
|
def report_results(config, stats):
|
||||||
|
|
||||||
wins, losses, draws, crashes, timelosses = stats
|
wins, losses, draws, crashes, timelosses = stats
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
'test_id' : workload['test']['id'],
|
'test_id' : config.workload['test']['id'],
|
||||||
'result_id' : workload['result']['id'],
|
'result_id' : config.workload['result']['id'],
|
||||||
'wins' : wins,
|
'wins' : wins,
|
||||||
'losses' : losses,
|
'losses' : losses,
|
||||||
'draws' : draws,
|
'draws' : draws,
|
||||||
@@ -433,13 +429,14 @@ def unzip_delete_file(source, outdir):
|
|||||||
os.remove(source)
|
os.remove(source)
|
||||||
|
|
||||||
|
|
||||||
def make_command(arguments, engine, src_path, network_path):
|
def make_command(config, engine, src_path, network_path):
|
||||||
|
|
||||||
command = 'make %s=%s EXE=%s -j%d' % (
|
compiler = config.compilers[engine][0]
|
||||||
['CC', 'CXX']['++' in SYSTEM_COMPILERS[engine][0]], SYSTEM_COMPILERS[engine][0], engine, arguments.threads)
|
comp_flag = ['CC', 'CXX']['++' in compiler]
|
||||||
|
command = 'make %s=%s EXE=%s -j%d' % (comp_flag, compiler, engine, config.threads)
|
||||||
|
|
||||||
if network_path != None:
|
if network_path != None:
|
||||||
path = os.path.relpath(os.path.abspath(network_path), src_path)
|
path = os.path.relpath(os.path.abspath(network_path), src_path)
|
||||||
command += ' EVALFILE=%s' % (path.replace('\\', '/'))
|
command += ' EVALFILE=%s' % (path.replace('\\', '/'))
|
||||||
|
|
||||||
return command.split()
|
return command.split()
|
||||||
@@ -644,7 +641,7 @@ def server_configure_worker(config):
|
|||||||
response = requests.post(target, data=payload, timeout=TIMEOUT_HTTP).json()
|
response = requests.post(target, data=payload, timeout=TIMEOUT_HTTP).json()
|
||||||
|
|
||||||
# Delete the machine.txt if we have saved an invalid machine number
|
# Delete the machine.txt if we have saved an invalid machine number
|
||||||
if 'error' in response and response['error'].lower() == "bad machine id":
|
if response.get('error', '').lower() == "bad machine id":
|
||||||
config.machine_id = 'None'
|
config.machine_id = 'None'
|
||||||
os.remove('machine.txt')
|
os.remove('machine.txt')
|
||||||
|
|
||||||
@@ -680,42 +677,44 @@ def server_request_workload(config):
|
|||||||
base_name = response['workload']['test']['base']['name' ]
|
base_name = response['workload']['test']['base']['name' ]
|
||||||
print('Workload [%s] %s vs [%s] %s\n' % (dev_engine, dev_name, base_engine, base_name))
|
print('Workload [%s] %s vs [%s] %s\n' % (dev_engine, dev_name, base_engine, base_name))
|
||||||
|
|
||||||
return None if 'workload' not in response else response['workload']
|
config.workload = response.get('workload', None)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
def complete_workload(arguments, workload):
|
def complete_workload(config):
|
||||||
|
|
||||||
dev_network = download_network_weights(arguments, workload, 'dev' )
|
dev_network = download_network_weights(config, 'dev' )
|
||||||
base_network = download_network_weights(arguments, workload, 'base')
|
base_network = download_network_weights(config, 'base')
|
||||||
|
|
||||||
dev_name = download_engine(arguments, workload, 'dev' , dev_network )
|
dev_name = download_engine(config, 'dev' , dev_network )
|
||||||
base_name = download_engine(arguments, workload, 'base', base_network)
|
base_name = download_engine(config, 'base', base_network)
|
||||||
if dev_name == None or base_name == None: return
|
if dev_name == None or base_name == None: return
|
||||||
|
|
||||||
dev_bench, dev_nps = run_benchmarks(arguments, workload, 'dev' , dev_name , dev_network )
|
dev_bench, dev_nps = run_benchmarks(config, 'dev' , dev_name , dev_network )
|
||||||
base_bench, base_nps = run_benchmarks(arguments, workload, 'base', base_name, base_network)
|
base_bench, base_nps = run_benchmarks(config, 'base', base_name, base_network)
|
||||||
average_nps = (dev_nps + base_nps) // 2
|
average_nps = (dev_nps + base_nps) // 2
|
||||||
|
|
||||||
dev_status = verify_benchmarks(arguments, workload, 'dev' , dev_bench )
|
dev_status = verify_benchmarks(config, 'dev' , dev_bench )
|
||||||
base_status = verify_benchmarks(arguments, workload, 'base', base_bench)
|
base_status = verify_benchmarks(config, 'base', base_bench)
|
||||||
|
|
||||||
if not dev_status or not base_status: return
|
if not dev_status or not base_status: return
|
||||||
ServerReporter.report_nps(arguments, workload, dev_nps, base_nps)
|
ServerReporter.report_nps(config, dev_nps, base_nps)
|
||||||
download_opening_book(arguments, workload)
|
download_opening_book(config)
|
||||||
|
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
# Construct each individual Cutechess argument, which differs by PGN output
|
# Construct each individual Cutechess argument, which differs by PGN output
|
||||||
cutechess_args = [
|
cutechess_args = [
|
||||||
build_cutechess_command(arguments, workload, dev_name, base_name, average_nps, ii)
|
build_cutechess_command(config, dev_name, base_name, average_nps, ii)
|
||||||
for ii in range(int(arguments.ncutechess))
|
for ii in range(int(config.ncutechess))
|
||||||
]
|
]
|
||||||
|
|
||||||
# Create a process for the each copy of run_and_parse_cutechess()
|
# Create a process for the each copy of run_and_parse_cutechess()
|
||||||
processes = [
|
processes = [
|
||||||
multiprocessing.Process(
|
multiprocessing.Process(
|
||||||
target=run_and_parse_cutechess,
|
target=run_and_parse_cutechess,
|
||||||
args=(arguments, workload, *cutechess_args[ii], ii))
|
args=(config, *cutechess_args[ii], ii))
|
||||||
for ii in range(int(arguments.ncutechess))
|
for ii in range(int(config.sockets))
|
||||||
]
|
]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -728,18 +727,18 @@ def complete_workload(arguments, workload):
|
|||||||
for process in processes: process.kill()
|
for process in processes: process.kill()
|
||||||
raise KeyboardInterrupt
|
raise KeyboardInterrupt
|
||||||
|
|
||||||
def download_opening_book(arguments, workload):
|
def download_opening_book(config):
|
||||||
|
|
||||||
# Log our attempts to download and verify the book
|
# Log our attempts to download and verify the book
|
||||||
book_sha256 = workload['test']['book']['sha' ]
|
book_sha256 = config.workload['test']['book']['sha' ]
|
||||||
book_source = workload['test']['book']['source']
|
book_source = config.workload['test']['book']['source']
|
||||||
book_name = workload['test']['book']['name' ]
|
book_name = config.workload['test']['book']['name' ]
|
||||||
book_path = os.path.join('Books', book_name)
|
book_path = os.path.join('Books', book_name)
|
||||||
print('\nFetching Opening Book [%s]' % (book_name))
|
print('\nFetching Opening Book [%s]' % (book_name))
|
||||||
|
|
||||||
# Download file if we do not already have it
|
# Download file if we do not already have it
|
||||||
if not os.path.isfile(book_path):
|
if not os.path.isfile(book_path):
|
||||||
if arguments.proxy: book_source = 'https://ghproxy.com/' + book_source
|
if config.proxy: book_source = 'https://ghproxy.com/' + book_source
|
||||||
download_file(book_source, book_name + '.zip')
|
download_file(book_source, book_name + '.zip')
|
||||||
unzip_delete_file(book_name + '.zip', 'Books/')
|
unzip_delete_file(book_name + '.zip', 'Books/')
|
||||||
|
|
||||||
@@ -757,27 +756,22 @@ def download_opening_book(arguments, workload):
|
|||||||
if book_sha256 != sha256:
|
if book_sha256 != sha256:
|
||||||
raise Exception('Invalid SHA for %s' % (book_name))
|
raise Exception('Invalid SHA for %s' % (book_name))
|
||||||
|
|
||||||
def download_network_weights(arguments, workload, branch):
|
def download_network_weights(config, branch):
|
||||||
|
|
||||||
# Some tests may not use Neural Networks
|
# Some tests may not use Neural Networks
|
||||||
network_name = workload['test'][branch]['network']
|
network_name = config.workload['test'][branch]['network']
|
||||||
if not network_name or network_name == 'None': return None
|
if not network_name or network_name == 'None': return None
|
||||||
|
|
||||||
# Log that we are obtaining a Neural Network
|
# Log that we are obtaining a Neural Network
|
||||||
pattern = 'Fetching Neural Network [ %s, %-4s ]'
|
pattern = 'Fetching Neural Network [ %s, %-4s ]'
|
||||||
print(pattern % (network_name, branch.upper()))
|
print(pattern % (network_name, branch.upper()))
|
||||||
|
|
||||||
# Neural Network requests require authorization
|
|
||||||
payload = {
|
|
||||||
'username' : arguments.username,
|
|
||||||
'password' : arguments.password,
|
|
||||||
}
|
|
||||||
|
|
||||||
# Fetch the Netural Network if we do not already have it
|
# Fetch the Netural Network if we do not already have it
|
||||||
network_path = os.path.join('Networks', network_name)
|
network_path = os.path.join('Networks', network_name)
|
||||||
if not os.path.isfile(network_path):
|
if not os.path.isfile(network_path):
|
||||||
api = url_join(arguments.server, 'clientGetNetwork')
|
target = url_join(config.server, 'clientGetNetwork')
|
||||||
download_file(url_join(api, network_name), network_path, payload)
|
payload = { 'username' : config.username, 'password' : config.password }
|
||||||
|
download_file(url_join(target, network_name), network_path, payload)
|
||||||
|
|
||||||
# Verify the download and delete partial or corrupted ones
|
# Verify the download and delete partial or corrupted ones
|
||||||
with open(network_path, 'rb') as network:
|
with open(network_path, 'rb') as network:
|
||||||
@@ -791,14 +785,14 @@ def download_network_weights(arguments, workload, branch):
|
|||||||
|
|
||||||
return network_path
|
return network_path
|
||||||
|
|
||||||
def download_engine(arguments, workload, branch, network):
|
def download_engine(arguments, branch, network):
|
||||||
|
|
||||||
engine = workload['test'][branch]['engine']
|
engine = config.workload['test'][branch]['engine']
|
||||||
branch_name = workload['test'][branch]['name']
|
branch_name = config.workload['test'][branch]['name']
|
||||||
commit_sha = workload['test'][branch]['sha']
|
commit_sha = config.workload['test'][branch]['sha']
|
||||||
source = workload['test'][branch]['source']
|
source = config.workload['test'][branch]['source']
|
||||||
build_path = workload['test'][branch]['build']['path']
|
build_path = config.workload['test'][branch]['build']['path']
|
||||||
private = 'artifacts' in workload['test'][branch]['build']
|
private = config.workload['test'][branch]['private']
|
||||||
|
|
||||||
# Naming as Engine-CommitSha[:8]-NetworkSha[:8]
|
# Naming as Engine-CommitSha[:8]-NetworkSha[:8]
|
||||||
final_name = '%s-%s' % (engine, commit_sha.upper()[:8])
|
final_name = '%s-%s' % (engine, commit_sha.upper()[:8])
|
||||||
@@ -835,7 +829,7 @@ def download_engine(arguments, workload, branch, network):
|
|||||||
|
|
||||||
# Artifact was missing, workload cannot be completed
|
# Artifact was missing, workload cannot be completed
|
||||||
if artifact_id == None:
|
if artifact_id == None:
|
||||||
ServerReporter.report_missing_artifact(arguments, workload, branch, desired, artifacts)
|
ServerReporter.report_missing_artifact(config, branch, desired, artifacts)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Download the binary that matches our desired artifact
|
# Download the binary that matches our desired artifact
|
||||||
@@ -866,7 +860,7 @@ def download_engine(arguments, workload, branch, network):
|
|||||||
# Build the engine and drop it into src_path
|
# Build the engine and drop it into src_path
|
||||||
print('\nBuilding [%s]' % (final_path))
|
print('\nBuilding [%s]' % (final_path))
|
||||||
output_name = os.path.join(src_path, engine)
|
output_name = os.path.join(src_path, engine)
|
||||||
command = make_command(arguments, engine, src_path, network)
|
command = make_command(config, engine, src_path, network)
|
||||||
process = Popen(command, cwd=src_path, stdout=PIPE, stderr=STDOUT)
|
process = Popen(command, cwd=src_path, stdout=PIPE, stderr=STDOUT)
|
||||||
cxx_output = process.communicate()[0].decode('utf-8')
|
cxx_output = process.communicate()[0].decode('utf-8')
|
||||||
print (cxx_output)
|
print (cxx_output)
|
||||||
@@ -885,33 +879,36 @@ def download_engine(arguments, workload, branch, network):
|
|||||||
|
|
||||||
# Manual builds should have exited by now
|
# Manual builds should have exited by now
|
||||||
if not private:
|
if not private:
|
||||||
ServerReporter.report_build_fail(arguments, workload, branch, cxx_output)
|
ServerReporter.report_build_fail(config, branch, cxx_output)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def run_benchmarks(arguments, workload, branch, engine, network):
|
def run_benchmarks(config, branch, engine, network):
|
||||||
|
|
||||||
cores = arguments.threads
|
|
||||||
queue = multiprocessing.Queue()
|
queue = multiprocessing.Queue()
|
||||||
name = workload['test'][branch]['name']
|
name = config.workload['test'][branch]['name']
|
||||||
private = 'artifacts' in workload['test'][branch]['build']
|
private = config.workload['test'][branch]['private']
|
||||||
print('\nRunning %dx Benchmarks for %s' % (cores, name))
|
print('\nRunning %dx Benchmarks for %s' % (config.threads, name))
|
||||||
|
|
||||||
for ii in range(cores):
|
for ii in range(config.threads):
|
||||||
args = [os.path.join('Engines', engine), queue]
|
args = [os.path.join('Engines', engine), queue]
|
||||||
if private and network: args.append(network)
|
if private and network: args.append(network)
|
||||||
multiprocessing.Process(target=run_bench, args=args).start()
|
multiprocessing.Process(target=run_bench, args=args).start()
|
||||||
|
|
||||||
bench, nps = list(zip(*[queue.get() for ii in range(cores)]))
|
bench, nps = list(zip(*[queue.get() for ii in range(config.threads)]))
|
||||||
if len(set(bench)) > 1: return (0, 0) # Flag an error
|
if len(set(bench)) > 1: return (0, 0) # Flag an error
|
||||||
|
|
||||||
print('Bench for %s is %d' % (name, bench[0]))
|
print('Bench for %s is %d' % (name, bench[0]))
|
||||||
print('Speed for %s is %d' % (name, sum(nps) // cores))
|
print('Speed for %s is %d' % (name, sum(nps) // config.threads))
|
||||||
return bench[0], sum(nps) // cores
|
return bench[0], sum(nps) // config.threads
|
||||||
|
|
||||||
def verify_benchmarks(arguments, workload, branch, bench):
|
def verify_benchmarks(config, branch, bench):
|
||||||
if bench != int(workload['test'][branch]['bench']):
|
|
||||||
ServerReporter.report_bad_bench(arguments, workload, branch, bench)
|
# Report mismatched benches [ Which will stop the test ]
|
||||||
return bench == int(workload['test'][branch]['bench'])
|
if bench != int(config.workload['test'][branch]['bench']):
|
||||||
|
ServerReporter.report_bad_bench(config, branch, bench)
|
||||||
|
|
||||||
|
# Make sure we also quit if the benches did not match
|
||||||
|
return bench == int(config.workload['test'][branch]['bench'])
|
||||||
|
|
||||||
def build_cutechess_command(arguments, workload, dev_cmd, base_cmd, nps, cutechess_idx):
|
def build_cutechess_command(arguments, workload, dev_cmd, base_cmd, nps, cutechess_idx):
|
||||||
|
|
||||||
@@ -937,12 +934,12 @@ def build_cutechess_command(arguments, workload, dev_cmd, base_cmd, nps, cuteche
|
|||||||
base_options += ' SyzygyPath=%s' % (path)
|
base_options += ' SyzygyPath=%s' % (path)
|
||||||
|
|
||||||
# Private engines may need extra options to set their NNUE files
|
# Private engines may need extra options to set their NNUE files
|
||||||
if 'artifacts' in workload['test']['dev']['build'] and dev_network and dev_network != 'None':
|
if workload['test']['dev']['private'] and dev_network and dev_network != 'None':
|
||||||
dev_options += ' EvalFile=%s' % (os.path.join('../Networks', dev_network))
|
dev_options += ' EvalFile=%s' % (os.path.join('../Networks', dev_network))
|
||||||
dev_name += '-%s' % (dev_network)
|
dev_name += '-%s' % (dev_network)
|
||||||
|
|
||||||
# Private engines may need extra options to set their NNUE files
|
# Private engines may need extra options to set their NNUE files
|
||||||
if 'artifacts' in workload['test']['base']['build'] and base_network and base_network != 'None':
|
if workload['test']['base']['private'] and base_network and base_network != 'None':
|
||||||
base_options += ' EvalFile=%s' % (os.path.join('../Networks', base_network))
|
base_options += ' EvalFile=%s' % (os.path.join('../Networks', base_network))
|
||||||
base_name += '-%s' % (base_network)
|
base_name += '-%s' % (base_network)
|
||||||
|
|
||||||
@@ -966,7 +963,7 @@ def build_cutechess_command(arguments, workload, dev_cmd, base_cmd, nps, cuteche
|
|||||||
if SYZYGY_WDL_PATH and workload['test']['syzygy_adj'] != 'DISABLED':
|
if SYZYGY_WDL_PATH and workload['test']['syzygy_adj'] != 'DISABLED':
|
||||||
flags += '-tb %s' % (SYZYGY_WDL_PATH.replace('\\', '\\\\'))
|
flags += '-tb %s' % (SYZYGY_WDL_PATH.replace('\\', '\\\\'))
|
||||||
|
|
||||||
concurrency = arguments.threads / arguments.ncutechess
|
concurrency = config.threads / config.ncutechess
|
||||||
concurrency = concurrency // max(dev_threads, base_threads)
|
concurrency = concurrency // max(dev_threads, base_threads)
|
||||||
|
|
||||||
games = int(concurrency * workload['test']['workload_size'])
|
games = int(concurrency * workload['test']['workload_size'])
|
||||||
@@ -1014,7 +1011,7 @@ def run_and_parse_cutechess(arguments, workload, concurrency, command, cutechess
|
|||||||
for error in errors:
|
for error in errors:
|
||||||
if error in score_reason:
|
if error in score_reason:
|
||||||
pgn = find_pgn_error(score_reason, command)
|
pgn = find_pgn_error(score_reason, command)
|
||||||
ServerReporter.report_engine_error(arguments, workload, line, pgn)
|
ServerReporter.report_engine_error(arguments, line, pgn)
|
||||||
|
|
||||||
# All remaining processing is for score updates only
|
# All remaining processing is for score updates only
|
||||||
if not line.startswith('Score of'):
|
if not line.startswith('Score of'):
|
||||||
@@ -1029,7 +1026,7 @@ def run_and_parse_cutechess(arguments, workload, concurrency, command, cutechess
|
|||||||
# Report new results to the server
|
# Report new results to the server
|
||||||
wld = [score[ii] - sent[ii] for ii in range(3)]
|
wld = [score[ii] - sent[ii] for ii in range(3)]
|
||||||
stats = wld + [crashes, timelosses]
|
stats = wld + [crashes, timelosses]
|
||||||
status = ServerReporter.report_results(arguments, workload, stats).json()
|
status = ServerReporter.report_results(arguments, stats).json()
|
||||||
|
|
||||||
# Reset the reporting since this report was a success
|
# Reset the reporting since this report was a success
|
||||||
crashes = timelosses = 0
|
crashes = timelosses = 0
|
||||||
@@ -1052,7 +1049,7 @@ def run_and_parse_cutechess(arguments, workload, concurrency, command, cutechess
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
config = Configuration()
|
config = Configuration() # System info, Cmdline arguments, and Workload
|
||||||
|
|
||||||
cutechess_error = '[Note] Unable to fetch Cutechess location and download it!'
|
cutechess_error = '[Note] Unable to fetch Cutechess location and download it!'
|
||||||
setup_error = '[Note] Unable to establish initial connection with the Server!'
|
setup_error = '[Note] Unable to establish initial connection with the Server!'
|
||||||
@@ -1061,17 +1058,21 @@ if __name__ == '__main__':
|
|||||||
try_forever(server_download_cutechess, [config], cutechess_error)
|
try_forever(server_download_cutechess, [config], cutechess_error)
|
||||||
try_forever(server_configure_worker, [config], setup_error )
|
try_forever(server_configure_worker, [config], setup_error )
|
||||||
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
# Cleanup on each workload request
|
# Cleanup on each workload request
|
||||||
cleanup_client()
|
cleanup_client()
|
||||||
|
|
||||||
workload = try_forever(server_request_workload, [config], connection_error)
|
# Keep asking for a workload until we get a response
|
||||||
|
try_forever(server_request_workload, [config], connection_error)
|
||||||
|
|
||||||
if workload: complete_workload(arguments, workload)
|
# Complete the workload if there was work to be done
|
||||||
|
if config.workload: complete_workload(config)
|
||||||
|
|
||||||
|
# Otherwise --fleet workers will exit when there is no work
|
||||||
elif config.fleet: break
|
elif config.fleet: break
|
||||||
|
|
||||||
|
# In either case, wait before requesting again
|
||||||
else: time.sleep(TIMEOUT_WORKLOAD)
|
else: time.sleep(TIMEOUT_WORKLOAD)
|
||||||
|
|
||||||
# Check for exit signal via openbench.exit
|
# Check for exit signal via openbench.exit
|
||||||
|
|||||||
+8
-6
@@ -49,12 +49,14 @@ class Profile(Model):
|
|||||||
|
|
||||||
class Machine(Model):
|
class Machine(Model):
|
||||||
|
|
||||||
user = ForeignKey(User, PROTECT, related_name='owner')
|
user = ForeignKey(User, PROTECT, related_name='owner')
|
||||||
mnps = FloatField(default=0.00)
|
mnps = FloatField(default=0.00)
|
||||||
updated = DateTimeField(auto_now=True)
|
dev_mnps = FloatField(default=0.00)
|
||||||
secret = CharField(max_length=64, default='None')
|
base_mnps = FloatField(default=0.00)
|
||||||
info = JSONField()
|
updated = DateTimeField(auto_now=True)
|
||||||
workload = IntegerField(default=0)
|
secret = CharField(max_length=64, default='None')
|
||||||
|
info = JSONField()
|
||||||
|
workload = IntegerField(default=0)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '[%d] %s' % (self.id, self.user.username)
|
return '[%d] %s' % (self.id, self.user.username)
|
||||||
|
|||||||
@@ -638,6 +638,7 @@ def workload_to_dictionary(test, result):
|
|||||||
'time_control' : test.dev_time_control,
|
'time_control' : test.dev_time_control,
|
||||||
'nps' : OPENBENCH_CONFIG['engines'][test.dev_engine]['nps'],
|
'nps' : OPENBENCH_CONFIG['engines'][test.dev_engine]['nps'],
|
||||||
'build' : OPENBENCH_CONFIG['engines'][test.dev_engine]['build'],
|
'build' : OPENBENCH_CONFIG['engines'][test.dev_engine]['build'],
|
||||||
|
'private' : OPENBENCH_CONFIG['engines'][test.dev_engine]['private'],
|
||||||
},
|
},
|
||||||
|
|
||||||
'base' : {
|
'base' : {
|
||||||
@@ -652,6 +653,7 @@ def workload_to_dictionary(test, result):
|
|||||||
'time_control' : test.base_time_control,
|
'time_control' : test.base_time_control,
|
||||||
'nps' : OPENBENCH_CONFIG['engines'][test.base_engine]['nps'],
|
'nps' : OPENBENCH_CONFIG['engines'][test.base_engine]['nps'],
|
||||||
'build' : OPENBENCH_CONFIG['engines'][test.base_engine]['build'],
|
'build' : OPENBENCH_CONFIG['engines'][test.base_engine]['build'],
|
||||||
|
'private' : OPENBENCH_CONFIG['engines'][test.base_engine]['private'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-3
@@ -18,7 +18,7 @@
|
|||||||
# #
|
# #
|
||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
|
|
||||||
import os, hashlib, datetime, json, secrets, re
|
import os, hashlib, datetime, json, secrets, sys, re
|
||||||
|
|
||||||
import django.http
|
import django.http
|
||||||
import django.shortcuts
|
import django.shortcuts
|
||||||
@@ -696,8 +696,11 @@ def client_submit_nps(request):
|
|||||||
machine, response = client_verify_worker(request)
|
machine, response = client_verify_worker(request)
|
||||||
if response != None: return response
|
if response != None: return response
|
||||||
|
|
||||||
# Update the NPS counter for the GUI views
|
# Update the NPS counters for the GUI views
|
||||||
machine.mnps = float(request.POST['nps']) / 1e6; machine.save()
|
machine.mnps = float(request.POST['nps' ]) / 1e6;
|
||||||
|
machine.dev_mnps = float(request.POST['dev_nps' ]) / 1e6;
|
||||||
|
machine.base_mnps = float(request.POST['base_nps']) / 1e6;
|
||||||
|
machine.save()
|
||||||
|
|
||||||
# Pass back an empty JSON response
|
# Pass back an empty JSON response
|
||||||
return JsonResponse({})
|
return JsonResponse({})
|
||||||
|
|||||||
Reference in new issue
Block a user