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

Miscellaneous improvements (2024-04-22) #194

Merged
merged 10 commits into from
Apr 22, 2024
Merged

Conversation

aphedges
Copy link
Contributor

I made most of these changes around a year ago, but I never merged them. This PR contains cleaned up versions of them, as well as some newer commits to fix builds and make development easier.

aphedges added 10 commits July 11, 2023 20:24
These are normally ignored for robustness, but they should be raised
during development so they are not missed. These exceptions can be
enabled by setting the `ALLAN_DEBUG` environment variable.

There is one ignored exception that isn't being reraised here, but that
`try` statement is not for unexpected behavior like these are.
There were modules that weren't covered by the documentation and modules
covered by the documentation that no longer exist.
I did not fix all warnings because they were too difficult for me to
resolve.
These will be especially useful if the multi-brain code is ever merged.
It previously used `str`, which required an extra step of conversion
when the DAIDE command had already been parsed. This simplifies common
code paths at the cost of making uncommon code paths slightly more
complex.
There is no reason for this function to be contained by another.
The `rollout_length` and `rollout_n_order` fields are declared in some,
but not all, subclasses of `DipnetBot`. For type safety, they now have a
default value of 1 in `get_state_value()` if they are not present on the
`bot` object.
PyCharm was unable to detect that the package was installed because
`requirements.txt` used `karma_sphinx_theme` instead.
It is now very simple to run pre-commit checks and tests, as well as to
build a container for playing games.
The model weights for the ALLAN bot's game engine were originally stored
in the cloud,[^1] but the link is now dead ~5 years later. Instead of
relying on this external link, we now have a special OCI image created
to store the file. In addition to solving the problem of the dead link,
it allows automatic local caching of the file during the build process.

Because the file was no longer available online, I extracted it from
`allanumd/allan_bots:2.7`,[^2] which was created before I optimized the
build to not include the original zip file.

I used the following commands to extract the zip file from the existing
image:

```shell
docker create --name old_bot allanumd/allan_bots:2.7
docker cp old_bot:/model/src/model_server/neurips2019-sl_model.zip .
docker rm old_bot
```

I then created a `Dockerfile` for creating the dedicated OCI image:

```dockerfile
FROM scratch
COPY neurips2019-sl_model.zip .
```

Once that was done, I ran the following commands to create and upload
the OCI image containing only the zip file:

```shell
docker build --tag allanumd/allan_bots:model_zip .
docker push allanumd/allan_bots:model_zip
```

I modified the main `Dockerfile` to mount this OCI image during the
normal build process so the zip file could be used.

[^1]: https://f002.backblazeb2.com/file/ppaquette-public/benchmarks/neurips2019-sl_model.zip
[^2]: https://hub.docker.com/layers/allanumd/allan_bots/2.7/images/sha256-bb282d9e1b9a7255a1efe60a6f0bcc1610fcd4bcae7757cecdb04b0a4526b2b4
@aphedges aphedges added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Apr 22, 2024
@aphedges aphedges self-assigned this Apr 22, 2024
@aphedges aphedges merged commit 1381335 into main Apr 22, 2024
2 checks passed
@aphedges aphedges deleted the misc-improvements-2024-04-22 branch April 22, 2024 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant