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

Matrix testing on different python version still always uses python 3.12 #123

Closed
pmrv opened this issue Jul 12, 2024 · 10 comments · Fixed by #124
Closed

Matrix testing on different python version still always uses python 3.12 #123

pmrv opened this issue Jul 12, 2024 · 10 comments · Fixed by #124
Assignees

Comments

@pmrv
Copy link
Contributor

pmrv commented Jul 12, 2024

The unit tests seem to be run always with python 3.12, even if the unit test workflow says it's 3.9/3.10/whatever.
By accident I used a 3.12 syntax feature in this PR, which should (and does locally) make older pythons crash, but the unit test matrix runs fine. So I stuck import sys; print(sys.version) into the tests and it does report here that it runs 3.12 even though it's supposed to be the 3.9 test.

@pmrv
Copy link
Contributor Author

pmrv commented Jul 12, 2024

I will revert the commits that added the print because I'd like the merge the corresponding PR soon, but I hope the link to the CI results stay alive. If not it's easy enough to recreate.

@liamhuber liamhuber self-assigned this Jul 12, 2024
@liamhuber
Copy link
Member

Yikes, good catch. I immediately assumed it was a simple error on my part in failing to pass an input variable through the call chain, but in fact the code chain looks fine:

Then I realized I could just look at the logs to confirm this, and it's the same thing: the 3.9 flag is successfully getting passed all the way through to conda-incubator/setup-miniconda:

Screen Shot 2024-07-12 at 09 20 27 Screen Shot 2024-07-12 at 09 22 44

Indeed, the conda setup correctly shows 3.9 being requested:

Screen Shot 2024-07-12 at 09 39 48

And once we get the whole thing installed and run conda list for the logs, we still see the correct version of python:

Screen Shot 2024-07-12 at 09 29 02

I then thought maybe we mess up the system variables? But the pyiron config business sets CONDA: /home/runner/miniconda3, which is exactly correct.

After that we just coverage run. The only remaining possibility I see for an issue with the workflow is that this command is somehow invoking the wrong version of python, but still has all the right packages? This is weird though as the env reports look fine here too:

Screen Shot 2024-07-12 at 09 38 10

I will revert the commits that added the print because I'd like the merge the corresponding PR soon, but I hope the link to the CI results stay alive. If not it's easy enough to recreate.

Is there any possibility that somehow the reporting itself is the problem? I see you force-pushed in the linked PR so I can't see the source of the report. It seems extremely unlikely to me that the report is wrong, but given that the logs consistently show the right version throughout, I'm just very lost.

@jan-janssen
Copy link
Member

It is very strange you have python =3.9.19 and python_abi =3.12 in the same environment, it should be python_abi =3.9. This seems to be related to the mamba env update command as I do not see the same issue on the repositories which directly set the environment-file in the conda-incubator/setup-miniconda action.

@liamhuber
Copy link
Member

Very nice observation. So coverage run is really invoking the wrong executable.

Given that the python version kwarg is getting passed all the way to the conda incubator, it's a matter of seeing what other input we're passing that's creating a conflict (or, much less likely, there is a bug in the incubator action)

@liamhuber
Copy link
Member

Also as far as I recall, we are writing our env file to the default location for the incubator setup, so even though it's not being set explicitly it should be getting passed in just fine. I'll double check that when I get to this though.

@liamhuber
Copy link
Member

The problem appears a mixture of mamba update and having python versions explicitly in the env file. As you suggest, Jan, passing the env file directly to setup-miniconda solves this, but then we sacrifice caching.

The mamba update (and indeed the rest of the caching procedure) is exactly from the conda-incubator docs on caching, which is most certainly what I followed when building this action. The interplay between the action argument for python versions and the env file used in the update specifying python versions is just a really unfortunate edge case that they aren't aware of/don't bother documenting.

I'm working on a PR (#124) which solves this by decomposing the caching into two steps so we can cache and use the file directly at invocation of setup-miniconda. I'm quite confident it will work, but I still need to squash bugs in getting all the pathing working. I'll try to get to it tonight, but this might drag into tomorrow despite my promise to get a new release out by the end of the day.

@pmrv
Copy link
Contributor Author

pmrv commented Jul 23, 2024

Thanks! Like I said it's a not a time critical issue, but good that you figured it out so quickly.

@jan-janssen
Copy link
Member

The problem appears a mixture of mamba update and having python versions explicitly in the env file. As you suggest, Jan, passing the env file directly to setup-miniconda solves this, but then we sacrifice caching.

At least in my tests on the packages without pyiron/actions caching is no longer faster. Downloading the cache from Github takes longer than downloading the packages from anaconda.

@liamhuber
Copy link
Member

The problem appears a mixture of mamba update and having python versions explicitly in the env file. As you suggest, Jan, passing the env file directly to setup-miniconda solves this, but then we sacrifice caching.

At least in my tests on the packages without pyiron/actions caching is no longer faster. Downloading the cache from Github takes longer than downloading the packages from anaconda.

My recent experience is that for very simple envs (the pyiron_snippets unit test env), loading the cache is indeed slightly slower than doing everything from scratch (35s vs 30s), but for a "complex" environment (pyiron_base + dask, neither with version pins) uncaching is significantly faster (27s vs 1m8s). Qualitatively, the gains on more complex setups seem worth risking the minor hit to performance for things that are already fast. Further, although my tests were N=1 and not scientific at all, un-caching seems pretty consistent -- so if you look at pyiron_atomistics where the mamba setup step is taking ~1.5m, we might be able to see some real gains.

Screen Shot 2024-07-23 at 10 48 53

@liamhuber liamhuber linked a pull request Jul 23, 2024 that will close this issue
@liamhuber
Copy link
Member

The speedup between writing and reading the cache is significant for pyiron_workflow: Ubuntu about 1.5m -> 0.75m, windows from 5m -> 2m. OSX was waiting too long in the queue so I don't know the speedup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants