Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fastchess version #2180

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/fishtest/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
according to the route/URL mapping defined in `__init__.py`.
"""

WORKER_VERSION = 253
WORKER_VERSION = 254


@exception_view_config(HTTPException)
Expand Down
8 changes: 4 additions & 4 deletions worker/games.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def cache_read(cache, name):

try:
return (Path(cache) / name).read_bytes()
except Exception as e:
except Exception:
return None


Expand All @@ -166,7 +166,7 @@ def cache_write(cache, name, data):

# Remove the temporary file
os.remove(temp_file.name)
except Exception as e:
except Exception:
return


Expand All @@ -177,7 +177,7 @@ def cache_remove(cache, name):

try:
(Path(cache) / name).unlink()
except Exception as e:
except Exception:
return


Expand Down Expand Up @@ -230,7 +230,7 @@ def send_api_post_request(api_url, payload, quiet=False):
valid_response = True
try:
response = response.json()
except:
except json.JSONDecodeError:
valid_response = False
if valid_response and not isinstance(response, dict):
valid_response = False
Expand Down
2 changes: 1 addition & 1 deletion worker/sri.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"__version": 253, "updater.py": "KiNaNadQJzjX85e2joCkfy87KUWIHizx+80xiFWMF7G7av2rDQaRrawnvhIjn9tL", "worker.py": "A3XMZNXEhv4Vi3qZYG6ZPBNROtWWiX4s8tmHCUD9bqxR9vmddPBOqvsF/Tfxu7w7", "games.py": "IZmJeczQV7IDMOvWS1NqR/tPe+Zg3rI8D1QDYIz/dvRE8auUU66PEjyfhWf9nbNe"}
{"__version": 254, "updater.py": "KiNaNadQJzjX85e2joCkfy87KUWIHizx+80xiFWMF7G7av2rDQaRrawnvhIjn9tL", "worker.py": "N3WmdZPsPvqhgmNRMF7OFW1N07s1BcG0RT2I3IyFX7ppaFw5Ho6E5XCG60WzFcYu", "games.py": "L3lFiXS7LlrwjYD6eTuFwMrv/iARyF7Gei33NTiZ0gBl63yKZ1OreT4l8ymeoqrY"}
23 changes: 12 additions & 11 deletions worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@
MIN_CLANG_MAJOR = 8
MIN_CLANG_MINOR = 0

WORKER_VERSION = 253
FASTCHESS_SHA = "894616028492ae6114835195f14a899f6fa237d3"

WORKER_VERSION = 254
FILE_LIST = ["updater.py", "worker.py", "games.py"]
HTTP_TIMEOUT = 30.0
INITIAL_RETRY_TIME = 15.0
Expand Down Expand Up @@ -122,7 +124,7 @@
<fishtest>/api/nn/<nnue> GET
<github-books>/git/trees/master GET
<github-books>/git/trees/master/blobs/<sha-book> GET
<github>/repos/Disservin/fastchess/zipball/<sha> GET
<github>/repos/Disservin/fastchess/zipball/<sha> GET
<github>/repos/<user-repo>/zipball/<sha> GET

Main loop <fishtest>/api/update_task POST
Expand Down Expand Up @@ -454,11 +456,10 @@ def setup_fastchess(worker_dir, compiler, concurrency, global_cache):
testing_dir = worker_dir / "testing"
testing_dir.mkdir(exist_ok=True)

fastchess_sha = "d053a83d641ace390d9079bdab7f7b94f103727f"
username = "Disservin"

fastchess = "fastchess" + EXE_SUFFIX
if verify_required_fastchess(testing_dir / fastchess, fastchess_sha):
if verify_required_fastchess(testing_dir / fastchess, FASTCHESS_SHA):
return True

# build it ourselves
Expand All @@ -469,34 +470,34 @@ def setup_fastchess(worker_dir, compiler, concurrency, global_cache):
"https://api.github.com/repos/"
+ username
+ "/fastchess/zipball/"
+ fastchess_sha
+ FASTCHESS_SHA
)

print("Building fastchess from sources at {}".format(item_url))

should_cache = False
blob = cache_read(global_cache, fastchess_sha + ".zip")
blob = cache_read(global_cache, FASTCHESS_SHA + ".zip")

if blob is None:
print("Downloading {}".format(item_url))
blob = requests_get(item_url).content
should_cache = True
else:
print("Using {} from global cache".format(fastchess_sha + ".zip"))
print("Using {} from global cache".format(FASTCHESS_SHA + ".zip"))

file_list = unzip(blob, tmp_dir)
prefix = os.path.commonprefix([n.filename for n in file_list])

if should_cache:
cache_write(global_cache, fastchess_sha + ".zip", blob)
cache_write(global_cache, FASTCHESS_SHA + ".zip", blob)

os.chdir(tmp_dir / prefix)

cmds = [
f"make -j{concurrency} tests CXX={compiler} GIT_SHA={fastchess_sha[0:8]} GIT_DATE=01010101",
f"make -j{concurrency} tests CXX={compiler} GIT_SHA={FASTCHESS_SHA[0:8]} GIT_DATE=01010101",
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",
f"make -j{concurrency} CXX={compiler} GIT_SHA={FASTCHESS_SHA[0:8]} GIT_DATE=01010101",
]

for cmd in cmds:
Expand Down Expand Up @@ -539,7 +540,7 @@ def setup_fastchess(worker_dir, compiler, concurrency, global_cache):
os.chdir(cd)
shutil.rmtree(tmp_dir, ignore_errors=True)

return verify_required_fastchess(testing_dir / fastchess, fastchess_sha)
return verify_required_fastchess(testing_dir / fastchess, FASTCHESS_SHA)


def validate(config, schema):
Expand Down
Loading