-
Notifications
You must be signed in to change notification settings - Fork 2
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
Docker tests #175
Docker tests #175
Conversation
Nice! |
AIM: Setting up python and installing all dependencies takes ~100s in GitHub actions - this is what we have to beat I managed to reduce the size of the container from 10GB to 1.8GB and simplify it which means it now only takes 35s to pull the image and start the container. Next step: Figure out how to tell pytest to actually use the pre-installed stuff and not reinstall everything again... |
pip-compile which we are using to create the requirements.txt ignores any pre-installed packages. I could not find a way to ensure it creates a requirements.txt for pytorch-cpu. Therefore, I am now simply installing mrpro after installing pytorch-cpu. I am also installing all the test requirements in the docker container. Pytest is now running in the container, we have got two containers one for python3.12 and python3.11. Somehow the test result is not picked up correctly. (I modified one test to fail). The badge is correct but the pipeline status is wrong. @schuenke I think you implemented this - could you have a look? |
A question for my understanding: why do we need a requirements.txt at all? |
You mean have a requirements.txt which only contains something like |
in a requirements.txt results in a fresh python3.12 conda-forge environment in
so all the notebook requirements are installed, without any pip compile etc.. |
pip-compile would have the same "problem". The only advantage of pip-compile I see now is, that we can modify the requirements.txt such that it does not install the nvidia packages and only installs the cpu version of torch. |
the advantage is pip-compile fixes the versions for binder to what they where when the tests ran last. For binderit will always install cuda if we install it from a requierements.txt, there is no way around it: pytorch from pypi defaults to cuda and will again bring in the cuda requirements if we don't install it with For binder, it might therefore be better to provide a environment.yml which is also supported.
(untested) to install only the requirements we specify in the pyproject.toml and cpu-torch. For the restIn test stuff, it should suffice to first install pytorch-cpu via pip and then mrpro. |
In the requirements.txt we could specifiy to use the cpu version and then binder would also stick to it. But your suggestion with the yml file should also work. |
ah, yes, in a binder/requierements.txt we can specify an |
Need to change Binder back to |
@fzimmermann89 I think the problem is related to this: Maybe we can use GITHUB_WORKSPACE and RUNNER_WORKSPACE for |
@ckolbPTB do we have pip inside the docker? |
yes, we use it in the github actions to install mrpro, e.g. |
the issue was that in our container python3 does not point to the correctly set up python.... |
Thanks for finding that out. Yes, I only ensured that python points to the right python installation but not python3. Will fix this in the container. I am struggeling to understand what you did to "fix" this and what the wrong python file had to do with a missing folder error message... |
sooo.... there were MANY issues. some of them with our .yaml, some of them with the run-notebook code... I forked the run-notebook action, made the output dir configurable (defaulting to workspace). Before, it was writing some temp output to workspace, but the notebooks results only to temp. THEN I noticed that it was calling This is why most of the debugging did not happen in this PR but in https://github.com/fzimmermann89/run-notebook/ |
Last issue (I think) is when to build the container images for the tests. I would suggest to build the container images and push them to dockerhub in a github action which runs whenever something is pushed to main. @fzimmermann89 @schuenke Does this make sense? |
I didn't follow the news regarding docker registries but: Does docker hub allow enough pulls for us for free (at some point the introduced some limits) Does github packages have higher limits for public reps? Rebuilding the images at push to main sounds good. |
dockerhub offers |
Nice! @ckolbPTB Will you split the docker creation at some point into a docker.yaml file? Or does it have to be in the pytest one? And in all other PRs always reuse the existing images? |
Yes, I will add this just before merging (if I don't forget) otherwise testing is difficult.
This is more challenging but I can have a look into it.
If it is in one file then it is easy to tell the pytests to wait for the docker creation. At least when we push to main, will the tests wait for up-to-date dockerimages. Should anything break we will get an errormessage then. Otherwise we would only detect the errors in whichever PR runs the next tests. |
Co-authored-by: Felix F Zimmermann <[email protected]>
@fzimmermann89 and @schuenke could you have another look at this and let me know if anything is missing/needs adapting? The checks which are listed as "Expected" are defined in the repo-settings. I can only adapt the names to the new ones once this is merged into main. |
TBH a lot of the github action stuff for me is voodoo and I can only do debugging by trial-and-error. So as the action run through, there are only some minor comments I can do (see above). Otherwise I would say we merge it after @schuenke gives his ok |
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.
Looks good as far as I can tell 😀
As I mentioned before, if there are any remaining problems, we will probably only notice when the actions are being used.
* Build containers and run all actions in them Co-authored-by: Felix F Zimmermann <[email protected]>
Run tests, notebooks and binder in docker container
Closes #151