-
Notifications
You must be signed in to change notification settings - Fork 232
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
Apptainer definition file for PySR #687
Conversation
Cool, thanks! Since we have a Also, would be nice to have some continuous integration tests like we have for the docker file. |
I had some trouble with that approach initially so I went with |
Thanks, could it also pull from the python-bullseye image rather than rockylinux image? Since the base image is hosted by docker I don’t see a compelling reason for the base images to be different |
Switched to bullseye for compatibility with the Dockerfile. I was using Rocky because that's what SchedMD uses as the base for the Slurm images built for Google's Cluster Toolkit (formerly HPC Toolkit). One my goals is to be able to bind mount the necessary Slurm commands and libs into a container so that you can use the Julia ClusterManagers interface to do distributed SR from within the container. Maybe your already know how to do that with Docker? |
Pull Request Test Coverage Report for Build 10345006057Details
💛 - Coveralls |
I see, thanks. This is a good use-case. Since I have no particular need to use bullseye, so maybe we could switch the defaults of both the Dockerfile and the Apptainer to use Rocky? You can change the default here: Line 6 in 3aee19e
|
I do Slurm stuff with PySR, but haven't done it from a container before. In principle it should be fine, I just haven't tried yet. One other thing that is needed is a function to install all packages, even the Julia extensions like for ClusterManagers.jl. I just made a PR #688 to add this function. So if your apptainer file calls |
Ok I merged #688 which will help for your stuff, do you want to merge those changes into your branch? |
It doesn't look like there are Rocky based containers for Julia on Docker Hub. I think bullseye is OK for multicore work. Transitioning to Rocky would require significant changes and testing on Slurm to ensure that it worked properly. |
Oh sorry I thought you meant you wanted to switch to Rocky. I'm happy with Bullseye too though. As long as both of the container types can have overall similar images. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For adding continuous integration testing, I would edit this file:
PySR/.github/workflows/CI_docker.yml
Lines 24 to 34 in d7e87b4
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
arch: ['linux/amd64'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build docker | |
run: docker build --platform=${{ matrix.arch }} -t pysr . | |
- name: Test docker | |
run: docker run --platform=${{ matrix.arch }} --rm pysr /bin/bash -c 'pip install pytest nbval && python3 -m pysr test main,cli,startup' |
and modify the build matrix to:
strategy:
matrix:
os: [ubuntu-latest]
arch: ['linux/amd64']
container:
- docker
- apptainer
Then you can use
if: ${{ matrix.container == "docker" }}
to run any docker-only steps, and similarly for apptainer. (I'm assuming there is a way to install apptainer in github actions.)
Call pysr.load_all_packages()
This is my first foray into Github CI testing. Would you prefer a modified CI_docker.yml file or a new CI_apptainer.yml file. My naive though is that the latter would be simpler but I could easily be missing something. |
Scanning the test failures it looks like most/all of them are the result of the tests being run in a read-only directory. To avoid a |
Is there a way you can mount the directory it uses for testing to a writeable directory? |
It got introduced in 1.2 as part of the Lots of improvements have gone in since 1.1. You should encourage your institute sys admins to upgrade. |
Put the Project stuff in /pysr/env Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
…IA_DEPOT_PATH element
I thought adding PYTHONPATH=/psyr had fixed the
error. I no longer see it in my local builds or tests. |
Good point. I asked them and they are planning on it in the few month timescale. I guess there will always be some clusters using older versions, so we might as well make it compatible (within reason). Maybe 1.1 is a good lower limit for now (until someone makes a feature request for even earlier) |
The error about |
Fix version.py not found issue
I looked in the container and |
The GitHub actions logs show:
which is odd, I thought it would install to paths within the image? Or are there other paths that need to be set before the pip installs? e.g., maybe it just copies the definition of |
Apptainer mounts the home directory of its initiator by default so those messages make sense but I didn't think about adding |
Relocate setting of testing env vars and add /home/runner/.local/bin to PATH
Oh I see. But shouldn’t it be installed inside the container rather than the user’s home directory (which thus wouldn’t be saved in the container)? |
Maybe the Python |
Looks like we can find this with |
I looked a little closer at my local environment and realized that I don't run the tests in the PySR directory. When I did that I reproduced the failure we're seeing, ugh. So I added steps to create a new directory specifically for testing in the CI action. I also experimented with the Apptainer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for accommodating all of these suggested changes and in general for the great contribution!!
fix: 686
This pull request adds an Apptainer definition file to PySR. Researchers can use it to build an Apptainer container that packages PySR and its dependencies (via a conda environment).