Add a (default=False) option to save PGNS.

To cleanup the Client, make a PGNs, Books, and Engines, folder on init
This commit is contained in:
Andrew Grant authored and Andrew Grant committed 2020-05-02 17:22:11 -04:00
1 parent d6a4cb8e6b
commit 620cc49c81
2 files changed
+17 -11

No files matched your search

+15 -8
View File
@@ -30,6 +30,7 @@ HTTP_TIMEOUT = 30 # Timeout in seconds for requests
WORKLOAD_TIMEOUT = 60 # Timeout when there is no work WORKLOAD_TIMEOUT = 60 # Timeout when there is no work
ERROR_TIMEOUT = 60 # Timeout when an error is thrown ERROR_TIMEOUT = 60 # Timeout when an error is thrown
GAMES_PER_CONCURRENCY = 32 # Total games to play per concurrency GAMES_PER_CONCURRENCY = 32 # Total games to play per concurrency
SAVE_PGN_FILES = False # Auto-save PGN output for engine pairings
CUSTOM_SETTINGS = { CUSTOM_SETTINGS = {
'Ethereal' : { 'args' : [] }, # Configuration for Ethereal 'Ethereal' : { 'args' : [] }, # Configuration for Ethereal
@@ -277,10 +278,15 @@ def getCutechessCommand(arguments, data, nps):
) )
# Options for opening selection # Options for opening selection
bookflags = '-openings file={0} format={1} order=random plies=16'.format( bookflags = '-openings file=Books/{0} format={1} order=random plies=16'.format(
data['test']['book']['name'], data['test']['book']['name'].split('.')[-1] data['test']['book']['name'], data['test']['book']['name'].split('.')[-1]
) )
# Save PGN files if requested as Engine-Dev_vs_Engine-Base
if SAVE_PGN_FILES:
bookflags += ' -pgnout PGNs/{0}-{1}_vs_{0}-{2}'.format(
data['test']['engine'], data['test']['dev']['name'], data['test']['base']['name'])
# Combine all flags and add the cutechess program callout # Combine all flags and add the cutechess program callout
options = ' '.join([generalflags, setupflags, devflags, baseflags, bookflags]) options = ' '.join([generalflags, setupflags, devflags, baseflags, bookflags])
if IS_WINDOWS: return 'cutechess.exe {0}'.format(options), concurrency if IS_WINDOWS: return 'cutechess.exe {0}'.format(options), concurrency
@@ -417,13 +423,13 @@ def verifyOpeningBook(data):
# Fetch the opening book if we don't have it # Fetch the opening book if we don't have it
print('\nFetching and Verifying Opening Book') print('\nFetching and Verifying Opening Book')
if not os.path.isfile(data['name']): if not os.path.isfile('Books/{0}'.format(data['name'])):
source = '{0}.zip'.format(data['source']) source = '{0}.zip'.format(data['source'])
name = '{0}.zip'.format(data['name']) name = '{0}.zip'.format(data['name'])
getAndUnzipFile(source, name, '') getAndUnzipFile(source, name, 'Books/')
# Verify data integrity with a hash # Verify data integrity with a hash
with open(data['name']) as fin: with open('Books/{0}'.format(data['name'])) as fin:
content = fin.read().encode('utf-8') content = fin.read().encode('utf-8')
sha = hashlib.sha256(content).hexdigest() sha = hashlib.sha256(content).hexdigest()
@@ -620,6 +626,11 @@ def main():
# Use OpenBench.py's path as the base pathway # Use OpenBench.py's path as the base pathway
os.chdir(os.path.dirname(os.path.abspath(__file__))) os.chdir(os.path.dirname(os.path.abspath(__file__)))
# Ensure we have our usual file folder structure
if not os.path.isdir('Engines'): os.mkdir('Engines')
if not os.path.isdir('Books' ): os.mkdir('Books' )
if not os.path.isdir('PGNs' ): os.mkdir('PGNs' )
# Expect a Username, Password, Server, and Threads value # Expect a Username, Password, Server, and Threads value
p = argparse.ArgumentParser() p = argparse.ArgumentParser()
p.add_argument('-U', '--username', help='Username', required=True) p.add_argument('-U', '--username', help='Username', required=True)
@@ -635,10 +646,6 @@ def main():
print("\nChecking for installed Compilers",) print("\nChecking for installed Compilers",)
getCompilationSettings(arguments.server) getCompilationSettings(arguments.server)
# Create the Engines directory if it does not exist
if not os.path.isdir('Engines'):
os.mkdir('Engines')
# All workload requests must be tied to a user and a machine. # All workload requests must be tied to a user and a machine.
# We also pass a thread count to inform the server what tests this # We also pass a thread count to inform the server what tests this
# machine can handle. We pass the osname in order to register machines. # machine can handle. We pass the osname in order to register machines.
+2 -3
View File
@@ -2,9 +2,8 @@
rm -rf __pycache__/ rm -rf __pycache__/
rm -rf Engines/ rm -rf Engines/
rm -rf Books/
rm -rf PGNs/
rm -rf tmp/ rm -rf tmp/
rm -rf *.pgn
rm -rf *.fen
rm -rf *.epd
rm -rf *.dll rm -rf *.dll
rm -rf cutechess* rm -rf cutechess*