-
Notifications
You must be signed in to change notification settings - Fork 388
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: cache pip installs #1057
CI: cache pip installs #1057
Conversation
8f3041e
to
6e1569e
Compare
Unclear how useful this is since the cache is invalidated any time these files change, and most of our PRs are dependabot PRs at the moment. It's probably most useful for the minimum dependencies which get updated very infrequently. |
.github/workflows/style.yaml
Outdated
@@ -19,6 +19,8 @@ jobs: | |||
uses: actions/[email protected] | |||
with: | |||
python-version: '3.10' | |||
cache: 'pip' | |||
cache-dependency-path: 'requirements/style.txt' |
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.
Do we have to do anything to skip the pip install after this?
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.
This is fun. It looks like cache
only caches downloads, not installs. Compared to develop, avoiding these downloads shaves 25 secs off the "Install pip dependencies" step, but adds 35 secs to the "Set up python" step because it has to download and unpack the cache.
I'm not convinced the caching is doing the correct thing. E.g.
It looks like the pip installs in this PR are using cached wheels somtimes (but, e.g., missing torch and downloading almost 1GB 😬 |
You beat me to it. Looks like there is an issue open for this: actions/setup-python#330 |
So this seems slower than not caching. The only other benefit of caching is that it may help avoid download issues when a runner has internet access issues, but that seems infrequent enough that I would rather have fast installs. I vote we close this. |
There should be a way to cache the install, else what is the point? (the only reason I looked so closely is because I think this is cool!) |
We could just use the cache action to cache everything: https://blog.allenai.org/python-caching-in-github-actions-e9452698e98d |
See actions/setup-python#330 (comment) for a matrix of install times. This is starting to look pretty good! We could still improve this by only caching the site-packages directory, but this varies by OS so I didn't try it here. Hopefully setup-python will add this feature someday, the current PR is a lot more lines than it was before. |
Other ideas for improving test times:
This last one is most worthwhile imo. Our tests only take 2 min on Linux but up to 9 min on macOS/Windows for some reason. The detection trainer tests are particularly slow. There's definitely a lot of room for improvement here. |
Definitely worthwhile to speed up tests -- do we have an open issue for this? If not can you make one? |
#1088 is for removing internet access and downloads which is the biggest low hanging fruit. I'm about to open a series of PRs to hopefully speed up our tutorial tests. They only get run on release, which is why it was difficult to improve them (or bother caring about them). |
* CI: cache pip installs * Update to new min deps filename * Use cache action instead * Cache releases too
* CI: cache pip installs * Update to new min deps filename * Use cache action instead * Cache releases too
See https://github.com/actions/setup-python and https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
Edit by Caleb
See actions/setup-python#330 (comment) for a writeup from Adam about the speedup from this PR.