-
Notifications
You must be signed in to change notification settings - Fork 167
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 GitHub Actions to cache environments and use dependent CI workflow structure #6867
use GitHub Actions to cache environments and use dependent CI workflow structure #6867
Conversation
14db8c2
to
b42892e
Compare
waiting on #6871 |
4f48d11
to
2b67cde
Compare
768a4e5
to
c3b74ad
Compare
15c38ca
to
010c71c
Compare
7813bf1
to
1957c80
Compare
4e555d0
to
c85ca3f
Compare
bd62f67
to
1aa4219
Compare
2777fdf
to
66a7a16
Compare
dddaddc
to
5e6c477
Compare
5cb04d0
to
701c697
Compare
c06c87a
to
0b6c595
Compare
4061d01
to
3e73b72
Compare
a4708e8
to
023f02d
Compare
…g environments directly with GitHub Actions bottleneck special-install tests behind the first test matrix
023f02d
to
3b5fa95
Compare
@jdavies-st Does this apply to running crds sync --contexts jwst_1009.pmap It appears to be caching 438591 bytes at the moment |
I've also added a |
You definitely don't want to use The way the CRDS caching should work is that workflow A runs the unit tests, pulling in all the CRDS reffiles it needs. At the end of the workflow, the state of the The trick is to only github actions cache the workflows that actually run pytest on the whole suite of tests, otherwise you will cache nothing, and you will be restoring empty caches. And make sure the cache key is something that changes occasionally but not too often, or it defeats the purpose of the caching. You could have the key be the CRDS context, but I don't think that's a very good proxy for which CRDS reffiles change for the |
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.
I don't think this refactor is going to make the current problem of the failure of fetching CRDS reffiles, which then causes the workflows to fail. This PR is not attached to any issue, but I assume that is the motivating factor?
What needs fixing is the github cache action setup - it should only run on jobs that run pytest on the full unit test suite, it should only populate the cache when run on push (merge PR) against master, and its key should be hashed from the contents of $HOME/crds_cache/references
, i.e. the files that get pulled from CRDS to run these tests.
Note that PRs are always from forks, so in order for the cache to be used, it needs to be generated from the default branch on spacetelescope/jwst. caches generated from branches on forks won't be used (security reasons).
All the other caching added in this PR on may speed up the build somewhat, but doesn't solve the above fundamental problem. And caching the build state of dependencies might have a bunch of unintended consequences that we don't understand as well. I would abide by the "if it's not broke, don't fix it" adage.
Finally, removing tox
is actually a step backwards, as it is the only way that we locally can run tests exactly the same way they're run via Github actions. This is an important middle layer that would be a shame to remove with better motivation. I would highly recommend not removing tox.ini
.
cache_crds: | ||
name: cache current CRDS operational context | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: cache-crds-${{ runner.os }}-${{ env.pythonLocation }} | ||
- run: pip install crds | ||
- run: pip freeze | ||
- run: echo "CRDS_CONTEXT=$(crds list --operational-context)" >> $GITHUB_ENV | ||
if: github.event.inputs.crds_context == '' | ||
- run: echo "CRDS_CONTEXT=${{ github.event.inputs.crds_context }}" >> $GITHUB_ENV | ||
if: github.event.inputs.crds_context != '' | ||
- uses: actions/cache@v3 | ||
if: env.CRDS_CONTEXT != '' | ||
with: | ||
path: ${{ env.CRDS_PATH }} | ||
key: crds-${{ env.CRDS_CONTEXT }} | ||
- run: crds sync --contexts ${{ env.CRDS_CONTEXT }} | ||
if: env.CRDS_CONTEXT != '' |
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.
I don't think you want to do this job. Running crds sync
will pull contexts over, but not actually do anything. What you want cached are the CRDS reference files in @HOME/crds_cache
that are actually used by the unit tests, a very, very small subset of the ~300GB snapshot of all CRDS reffiles.
The Github cache action was removed here It should be turned on again, making sure it only runs on jobs that run pytest, and it gets restored based on a hash of |
closing in favor of successor #7323 |
Notable changes:
Checklist