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
Use cache for python modules to optimize CI build time #15050
Use cache for python modules to optimize CI build time #15050
Conversation
Write-Output "python=$key" >> $env:GITHUB_OUTPUT | ||
} | ||
|
||
- name: (cache) Lookup Python modules |
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.
You know the actions/setup-python Action has caching built in, right?
All you would need is a few lines:
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
This way you're not stuck without whatever default Python version the Windows runner comes with, in case it falls out of date.
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 it allows us to specify for which branches/events it should work for (I'm mainly concerned about saving)? I know that there are ready-made actions, but they usually have limited configuration options. For this reason I do not use the cache action itself, but separate save and restore (there is more precise control over how it should behave).
From: #15028 (comment)
@ArkadiuszMichalski |
@donho Yes, here we only cache python libraries that are used for XML validation (requests rfc3987 pywin32 lxml). I did it separately, because if Scintilla/Lexilla optimization will be useless (or not accepted), at least these libraries can be cached (we use them in two places, so it seems unnecessary to install them over and over again). |
@chcg |
@ArkadiuszMichalski So I tried to launch 1 time for having the cache, then the 2nd time (almost immediately) for using the cache.
vs master last commit build:
As you can see, the result is not promising. Or the cache can be enabled in master? If it's the case, how can we test to see the gain of the PR? |
@donho We use cache only for
On Action page you can manually delete existing cache and repeat test or add on commit tittle But it's still possible that sometimes |
@donho In this PR in With the cache we reduce it to 3-5s, because that's how long it takes to restore the cache. So for example if the
with cache the same jobs will be always faster:
This may not be a spectacular result, but we save some energy and eliminate unnecessary network bandwidth. |
@ArkadiuszMichalski |
Partial implementation for #15028. This cause that XML validation in
before_build
andbuild_windows (Debug, Win32)
job take less time (python modules will be restored from the cache). We save something like 20 seconds or more (depending on the real download time of these libraries). In the case of XML validation only (without compilation) the improvement is significant.A short summary:
PYTHON_ALLOW_CACHE
setting tofalse
inCI_build.yml
file. There is no need to revert commit, we can turn this off and wait to solve the problem.[force nopythoncache]
flag in the commit title.I did it separately because I don't know if I will be able to optimize the
Scintilla/Lexilla
compilation for all jobs (currently I have a working version only forMSYS2
).