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
CI: pip and conda caching in all workflows #16518
Conversation
[skip azp] [skip circle]
…low. [skip azp] [skip circle]
[skip azp] [skip circle]
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.
The usage of cache-dependency-path: 'environment.yml'
doesn't make sense to me, since that .yml
file has little to do with the pip
installs. Reading https://github.com/actions/setup-python#caching-packages-dependencies doesn't help me either. Shouldn't you just remove those lines @tupui?
It does not work as the caching mechanism needs a file to look at. By default it looks for So I thought that the best compromise was to use |
But isn't that just worse than what we had? The ideal caching mechanism would always keep the installed wheels between jobs, and those would be specific to (a) platform, and (b) Python version. All those files are in That the cache gets invalidated when we touch |
id: cache | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip |
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.
To confirm: this did work, right? Or are you trying to change this because it didn't?
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.
It did work yes. See for instance https://github.com/scipy/scipy/runs/7168555851?check_suite_focus=true
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.
But isn't that just worse than what we had? The ideal caching mechanism would always keep the installed wheels between jobs, and those would be specific to (a) platform, and (b) Python version. All those files are in ~/.cache/pip. Now it's keyed instead on something that is not specific to platform or Python version, so does it all end up in one large cache?
If I am reading the PR description that added this correctly (actions/setup-python#266), I think it does exactly what we had: ${{ runner.os }}-pip
and adds the hash of the file.
id: cache | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip |
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.
It did work yes. See for instance https://github.com/scipy/scipy/runs/7168555851?check_suite_focus=true
Ah that is helpful, better than the docs. I agree, it does the right thing. Looks like cache reuse isn't visible yet. Cache is saved in some jobs (e.g., https://github.com/scipy/scipy/runs/7178309878?check_suite_focus=true) but not all - and not restored/used yet. Can you push another commit and check that this actually works then? |
[skip azp] [skip circle]
I think it works now. All jobs fetch some cache except the dbg but it's because it's not using the Python action. |
The thing I am seeing is for conda. We update the env even if we have a cache hit (this is where we lose some minutes now). In the doc they invalidate the cache from time to time to mitigate this. I would bump every week or day. What do you think? https://github.com/conda-incubator/setup-miniconda#caching-environments |
Yes, daily seems good. The two missing bits seem to be |
[skip azp] [skip circle]
Yes, done. |
That didn't quite work:
We can merge this PR minus the last commit, and do the conda caching separately if you prefer. |
[skip azp] [skip circle]
Indeed, this should do it. The path changed apparently as can be seen in the log. I used what's in the doc of the action and it matches the env variables.
|
[skip azp] [skip circle]
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.
Great, LGTM now, thanks @tupui!
Thanks Ralf! Small drop saved in our ocean of CI, but still 😅 |
Yes indeed! I'm looking forward to our big bucket of drops saved when we can remove all the |
If you want I can give it a stab for the GH jobs on linux/macOS. Or are we waiting for some missing pieces? |
Yes, there's a number of missing pieces - I'm hoping 3 months after the 1.9.0 release we can do it. |
actions/setup-python@v4
has a caching feature, which uses under the hoodactions/cache
.Before this PR, only one workflow was using
actions/cache
.