From 2e227a0754ca073bbeab7425a5c5034a52459cb2 Mon Sep 17 00:00:00 2001 From: Joost VandeVondele Date: Sat, 27 Jul 2024 11:01:17 +0200 Subject: [PATCH] Update to the renamed fastchess (no-hyphen) --- worker/games.py | 26 +++++++++++++------------- worker/sri.txt | 2 +- worker/worker.py | 32 ++++++++++++++++---------------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/worker/games.py b/worker/games.py index 37025b059..88a26c266 100644 --- a/worker/games.py +++ b/worker/games.py @@ -923,13 +923,13 @@ def shorten_hash(match): # Parse line like this: # Warning: New-SHA doesn't have option ThreatBySafePawn if "Warning:" in line and "doesn't have option" in line: - message = r'fast-chess says: "{}"'.format(line) + message = r'fastchess says: "{}"'.format(line) raise RunException(message) # Parse line like this: # Warning: Invalid value for option P: -354 if "Warning:" in line and "Invalid value" in line: - message = r'fast-chess says: "{}"'.format(line) + message = r'fastchess says: "{}"'.format(line) raise RunException(message) # Parse line like this: @@ -940,7 +940,7 @@ def shorten_hash(match): if "on time" in line: result["stats"]["time_losses"] += 1 - # fast-chess WLD and pentanomial output parsing + # fastchess WLD and pentanomial output parsing m = pattern_WLD.search(line) if m: try: @@ -1083,7 +1083,7 @@ def launch_fastchess( w_params = [] b_params = [] - # Run fast-chess binary. + # Run fastchess binary. # Stochastic rounding and probability for float N.p: (N, 1-p); (N+1, p) idx = cmd.index("_spsa_") cmd = ( @@ -1141,13 +1141,13 @@ def launch_fastchess( tc_limit, ) finally: - # We nicely ask fast-chess to stop. + # We nicely ask fastchess to stop. try: send_sigint(p) except Exception as e: print("\nException in send_sigint:\n", e, sep="", file=sys.stderr) # now wait... - print("\nWaiting for fast-chess to finish ... ", end="", flush=True) + print("\nWaiting for fastchess to finish ... ", end="", flush=True) try: p.wait(timeout=FASTCHESS_KILL_TIMEOUT) except subprocess.TimeoutExpired: @@ -1157,12 +1157,12 @@ def launch_fastchess( print("done", flush=True) except (OSError, subprocess.SubprocessError) as e: print( - "Exception starting fast-chess:\n", + "Exception starting fastchess:\n", e, sep="", file=sys.stderr, ) - raise WorkerException("Unable to start fast-chess. Error: {}".format(str(e))) + raise WorkerException("Unable to start fastchess. Error: {}".format(str(e))) return task_alive @@ -1178,7 +1178,7 @@ def run_games( clear_binaries, global_cache, ): - # This is the main fast-chess driver. + # This is the main fastchess driver. # It is ok, and even expected, for this function to # raise exceptions, implicitly or explicitly, if a # task cannot be completed. @@ -1246,7 +1246,7 @@ def run_games( start_game_index = opening_offset + input_total_games run_seed = int(hashlib.sha1(run["_id"].encode("utf-8")).hexdigest(), 16) % (2**64) - # Format options according to fast-chess syntax. + # Format options according to fastchess syntax. def parse_options(s): results = [] chunks = s.split("=") @@ -1348,7 +1348,7 @@ def parse_options(s): file=sys.stderr, ) - # Add EvalFile* with full path to fast-chess options, and download the networks if missing. + # Add EvalFile* with full path to fastchess options, and download the networks if missing. for option, net in required_nets(base_engine).items(): base_options.append("option.{}={}".format(option, net)) establish_validated_net(remote, testing_dir, net, global_cache) @@ -1478,8 +1478,8 @@ def make_player(arg): if any(substring in book.upper() for substring in ["FRC", "960"]): variant = "fischerandom" - # Run fast-chess binary. - fastchess = "fast-chess" + EXE_SUFFIX + # Run fastchess binary. + fastchess = "fastchess" + EXE_SUFFIX cmd = ( [ os.path.join(testing_dir, fastchess), diff --git a/worker/sri.txt b/worker/sri.txt index 28010dffb..8e31ed86a 100644 --- a/worker/sri.txt +++ b/worker/sri.txt @@ -1 +1 @@ -{"__version": 242, "updater.py": "Mg+pWOgGA0gSo2TuXuuLCWLzwGwH91rsW1W3ixg3jYauHQpRMtNdGnCfuD1GqOhV", "worker.py": "Pxo7PbstsI9ZyRBdzHVzQu+A89WaGcVL6fDFM1KXZGvAhMKHZxVB3XEvjewddRMw", "games.py": "BzNVX1zlHRuMtutT24IaZHA1O0f8EOL0aiPQUB3ET9G8vf4ig6W+FSza3JRdIi6M"} +{"__version": 242, "updater.py": "Mg+pWOgGA0gSo2TuXuuLCWLzwGwH91rsW1W3ixg3jYauHQpRMtNdGnCfuD1GqOhV", "worker.py": "cByOSq6A68BXEYsaY62BMPesVU/KRe9J1XcTFib97wLO7jK3+acHfQ3C8xzt6aCK", "games.py": "fRFEGLGxC6j9v+l1KGNgT4jpFKgZ4bl+XufUzmqAUCXH5feGsk5HT/U7fQIG0+hR"} diff --git a/worker/worker.py b/worker/worker.py index 2064c836e..5aa81418b 100644 --- a/worker/worker.py +++ b/worker/worker.py @@ -125,7 +125,7 @@ /api/nn/ GET /git/trees/master GET /git/trees/master/blobs/ GET - /repos/Disservin/fast-chess/zipball/ GET + /repos/Disservin/fastchess/zipball/ GET /repos//zipball/ GET Main loop /api/update_task POST @@ -397,7 +397,7 @@ def get_credentials(config, options, args): def verify_required_fastchess(fastchess_path, fastchess_sha): - # Verify that fast-chess is working and has the required minimum version. + # Verify that fastchess is working and has the required minimum version. if not fastchess_path.exists(): return False @@ -415,7 +415,7 @@ def verify_required_fastchess(fastchess_path, fastchess_sha): ) as p: errors = p.stderr.read() pattern = re.compile( - r"fast-chess alpha [0-9]*.[0-9]*.[0-9]* [0-9]*-([0-9a-f-]*)$" + r"fastchess alpha [0-9]*.[0-9]*.[0-9]* [0-9]*-([0-9a-f-]*)$" ) short_sha = "" for line in iter(p.stdout.readline, ""): @@ -424,12 +424,12 @@ def verify_required_fastchess(fastchess_path, fastchess_sha): print("Found", line.strip()) short_sha = m.group(1) except (OSError, subprocess.SubprocessError) as e: - print("Unable to run fast-chess. Error: {}".format(str(e))) + print("Unable to run fastchess. Error: {}".format(str(e))) return False if p.returncode != 0: print( - "Unable to run fast-chess. Return code: {}. Error: {}".format( + "Unable to run fastchess. Return code: {}. Error: {}".format( format_return_code(p.returncode), errors ) ) @@ -437,13 +437,13 @@ def verify_required_fastchess(fastchess_path, fastchess_sha): if len(short_sha) < 7: print( - "Unable to find a suitable sha of length 7 or more in the fast-chess version." + "Unable to find a suitable sha of length 7 or more in the fastchess version." ) return False if not fastchess_sha.startswith(short_sha): print( - "fast-chess sha {} required but the version shows {}".format( + "fastchess sha {} required but the version shows {}".format( fastchess_sha, short_sha ) ) @@ -457,10 +457,10 @@ def setup_fastchess(worker_dir, compiler, concurrency, global_cache): testing_dir = worker_dir / "testing" testing_dir.mkdir(exist_ok=True) - fastchess_sha = "f1ae6f8e13f49fd649c350d70d3e1ef24d01f373" + fastchess_sha = "58c8fb35c26fe5afffc21364afa7dbadc0afa909" username = "Disservin" - fastchess = "fast-chess" + EXE_SUFFIX + fastchess = "fastchess" + EXE_SUFFIX if verify_required_fastchess(testing_dir / fastchess, fastchess_sha): return True @@ -469,11 +469,11 @@ def setup_fastchess(worker_dir, compiler, concurrency, global_cache): item_url = ( "https://api.github.com/repos/" + username - + "/fast-chess/zipball/" + + "/fastchess/zipball/" + fastchess_sha ) - print("Building fast-chess from sources at {}".format(item_url)) + print("Building fastchess from sources at {}".format(item_url)) should_cache = False blob = cache_read(global_cache, fastchess_sha + ".zip") @@ -497,7 +497,7 @@ def setup_fastchess(worker_dir, compiler, concurrency, global_cache): cmds = [ f"make -j{concurrency} tests CXX={compiler} GIT_SHA={fastchess_sha[0:8]} GIT_DATE=01010101", - str(tmp_dir / prefix / ("fast-chess-tests" + EXE_SUFFIX)), + str(tmp_dir / prefix / ("fastchess-tests" + EXE_SUFFIX)), "make clean", f"make -j{concurrency} CXX={compiler} GIT_SHA={fastchess_sha[0:8]} GIT_DATE=01010101", ] @@ -520,13 +520,13 @@ def setup_fastchess(worker_dir, compiler, concurrency, global_cache): "Executing {} failed. Error: {}".format(cmd, errors) ) - shutil.copy("fast-chess" + EXE_SUFFIX, testing_dir) + shutil.copy("fastchess" + EXE_SUFFIX, testing_dir) os.chdir(cd) shutil.rmtree(tmp_dir) except Exception as e: print( - "Exception downloading, extracting or building fast-chess:\n", + "Exception downloading, extracting or building fastchess:\n", e, sep="", file=sys.stderr, @@ -829,7 +829,7 @@ def my_error(e): # Limit concurrency so that at least STC tests can run with the evailable memory # The memory need per engine is 16 for the TT Hash, 10 for the process 138 for the net and 16 per thread - # 60 is the need for fast-chess + # 60 is the need for fastchess # These numbers need to be up-to-date with the server values STC_memory = 2 * (16 + 10 + 138 + 16) max_concurrency = int((options.max_memory - 60) / STC_memory) @@ -1531,7 +1531,7 @@ def worker(): if not verify_toolchain(): return 1 - # Make sure we have a working fast-chess + # Make sure we have a working fastchess if not setup_fastchess( worker_dir, compiler, options.concurrency, options.global_cache ):