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

[CI] if latest contexts have changed, retrieve the previous contexts' test cache and then use ./setup_test_cache u to update #1099

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

zacharyburnett
Copy link
Collaborator

@zacharyburnett zacharyburnett commented Nov 25, 2024

This should decrease the time it takes to make a new test cache for the latest contexts, when the contexts change. I need to test this against a context change to make sure that u behaves as expected EDIT: tested in #1099 (comment)

This also removes duplication of caches by obviating the need for separate individual caches for each repository

Tasks

  • update or add relevant tests
  • update relevant docstrings and / or docs/ page
  • Does this PR change any API used downstream? (if not, label with no-changelog-entry-needed)
    • write news fragment(s) in changes/: echo "changed something" > changes/<PR#>.<changetype>.rst (see below for change types)
news fragment change types...
  • changes/<PR#>.hst.rst: HST reference files
  • changes/<PR#>.jwst.rst: JWST reference files
  • changes/<PR#>.roman.rst: Roman reference files
  • changes/<PR#>.doc.rst: documentation change
  • changes/<PR#>.testing.rst: change to tests or test automation
  • changes/<PR#>.general.rst: infrastructure or miscellaneous change

@zacharyburnett zacharyburnett self-assigned this Nov 25, 2024
@zacharyburnett zacharyburnett force-pushed the ci/update_partial_cache branch 2 times, most recently from c5ed0b1 to d7dce5b Compare November 25, 2024 18:49
@zacharyburnett zacharyburnett changed the title use ./setup_test_cache u to update a previous existing cache [CI] if latest contexts have changed, retrieve the previous contexts' test cache and then use ./setup_test_cache u to update Nov 25, 2024
@zacharyburnett
Copy link
Collaborator Author

zacharyburnett commented Nov 25, 2024

tested at https://github.com/spacetelescope/stenv/actions/runs/12017528869/job/33500260337 by manually creating a test-cache-hst_1194.pmap-jwst_1298.pmap cache and then running this workflow to update it to test-cache-hst_1195.pmap-jwst_1299.pmap. It appears to work; the new cache is about the same size as the old one, and ./setup_test_cache /tmp u gave this log:

+ usage='Usage: setup_test_cache CRDS_TEST_ROOT <c/u> where '\''c'\'' means clean and '\''u'\'' means update'
+ update=u
+ export CRDS_TEST_ROOT=/tmp
+ CRDS_TEST_ROOT=/tmp
+ '[' u = c ']'
+ export CRDS_PATH=/tmp/crds-cache-default-test
+ CRDS_PATH=/tmp/crds-cache-default-test
+ export CRDS_TESTING_CACHE=/tmp/crds-cache-test
+ CRDS_TESTING_CACHE=/tmp/crds-cache-test
+ export CRDS_SERVER_URL=https://hst-crds.stsci.edu/
+ CRDS_SERVER_URL=https://hst-crds.stsci.edu/
+ python -m crds.sync --all --stats --log-time --check-sha1sum --repair-files --organize=flat
2024-11-25 19:45:54,590 - CRDS - INFO -  Removing all context pickles.  Use --save-pickles to recreate for specified contexts.
2024-11-25 19:45:54,591 - CRDS - INFO -  Reorganizing 80 references from 'flat' to 'flat'
2024-11-25 19:46:44,696 - CRDS - INFO -  STARTED 2024-11-25 19:45:53.67
2024-11-25 19:46:44,696 - CRDS - INFO -  STOPPED 2024-11-25 19:46:44.69
2024-11-25 19:46:44,696 - CRDS - INFO -  ELAPSED 0:00:51.01
2024-11-25 19:46:44,696 - CRDS - INFO -        0 total-files at    0.0  total-files-per-second
2024-11-25 19:46:44,696 - CRDS - INFO -        0 total-bytes at    0.0  total-bytes-per-second
2024-11-25 19:46:44,696 - CRDS - INFO -  0 errors
2024-11-25 19:46:44,696 - CRDS - INFO -  0 warnings
2024-11-25 19:46:44,696 - CRDS - INFO -  7 infos
+ python -m crds.sync --files l2d0959cj_pfl.fits n7p1032ao_apt.fits q5417413o_pct.fits xaf1429el_wcp.fits y2r1559to_apt.fits y2r16006o_pct.fits y951738kl_hv.fits yas2005el_hv.fits p7d1548qj_idc.fits 3241637sm_tmt.fits 41g16069m_tmg.fits 43h1909cm_tmc.fits 43h1240om_tmc.fits --stats --log-time
2024-11-25 19:46:49,469 - CRDS - INFO -  Symbolic context 'hst-latest' resolves to 'hst_1195.pmap'
2024-11-25 19:46:49,469 - CRDS - INFO -  Syncing explicitly listed files.
2024-11-25 19:46:49,553 - CRDS - INFO -  STARTED 2024-11-25 19:46:48.63
2024-11-25 19:46:49,553 - CRDS - INFO -  STOPPED 2024-11-25 19:46:49.55
2024-11-25 19:46:49,553 - CRDS - INFO -  ELAPSED 0:00:00.91
2024-11-25 19:46:49,553 - CRDS - INFO -        0 total-files at    0.0  total-files-per-second
2024-11-25 19:46:49,554 - CRDS - INFO -        0 total-bytes at    0.0  total-bytes-per-second
2024-11-25 19:46:49,554 - CRDS - INFO -  0 errors
2024-11-25 19:46:49,554 - CRDS - INFO -  0 warnings
2024-11-25 19:46:49,554 - CRDS - INFO -  7 infos
+ python -m crds.sync --contexts hst_cos.imap --fetch-references --log-time --stats
2024-11-25 19:46:51,047 - CRDS - INFO -  STARTED 2024-11-25 19:46:50.08
2024-11-25 19:46:51,047 - CRDS - INFO -  STOPPED 2024-11-25 19:46:51.04
2024-11-25 19:46:51,047 - CRDS - INFO -  ELAPSED 0:00:00.96
2024-11-25 19:46:51,047 - CRDS - INFO -        0 total-files at    0.0  total-files-per-second
2024-11-25 19:46:51,047 - CRDS - INFO -        0 total-bytes at    0.0  total-bytes-per-second
2024-11-25 19:46:51,047 - CRDS - INFO -  0 errors
2024-11-25 19:46:51,047 - CRDS - INFO -  0 warnings
2024-11-25 19:46:51,047 - CRDS - INFO -  5 infos
+ export CRDS_SERVER_URL=https://jwst-crds.stsci.edu/
+ CRDS_SERVER_URL=https://jwst-crds.stsci.edu/
+ python -m crds.sync --all --stats --log-time --check-sha1sum --repair-files --organize=flat
2024-11-25 19:46:52,277 - CRDS - INFO -  Removing all context pickles.  Use --save-pickles to recreate for specified contexts.
2024-11-25 19:46:52,349 - CRDS - INFO -  Reorganizing 2 references from 'flat' to 'flat'
2024-11-25 19:47:03,101 - CRDS - INFO -  STARTED 2024-11-25 19:46:51.57
2024-11-25 19:47:03,101 - CRDS - INFO -  STOPPED 2024-11-25 19:47:03.10
2024-11-25 19:47:03,101 - CRDS - INFO -  ELAPSED 0:00:11.52
2024-11-25 19:47:03,101 - CRDS - INFO -        0 total-files at    0.0  total-files-per-second
2024-11-25 19:47:03,101 - CRDS - INFO -        0 total-bytes at    0.0  total-bytes-per-second
2024-11-25 19:47:03,101 - CRDS - INFO -  0 errors
2024-11-25 19:47:03,101 - CRDS - INFO -  0 warnings
2024-11-25 19:47:03,101 - CRDS - INFO -  7 infos
+ python -m crds.sync --files jwst_niriss_flat_0000.fits jwst_miri_flat_0006.fits --stats --log-time
2024-11-25 19:47:05,113 - CRDS - INFO -  Symbolic context 'jwst-latest' resolves to 'jwst_1299.pmap'
2024-11-25 19:47:05,113 - CRDS - INFO -  Syncing explicitly listed files.
2024-11-25 19:47:05,152 - CRDS - INFO -  STARTED 2024-11-25 19:47:04.41
2024-11-25 19:47:05,153 - CRDS - INFO -  STOPPED 2024-11-25 19:47:05.15
2024-11-25 19:47:05,153 - CRDS - INFO -  ELAPSED 0:00:00.73
2024-11-25 19:47:05,153 - CRDS - INFO -        0 total-files at    0.0  total-files-per-second
2024-11-25 19:47:05,153 - CRDS - INFO -        0 total-bytes at    0.0  total-bytes-per-second
2024-11-25 19:47:05,153 - CRDS - INFO -  0 errors
2024-11-25 19:47:05,153 - CRDS - INFO -  0 warnings
2024-11-25 19:47:05,153 - CRDS - INFO -  7 infos

@zacharyburnett zacharyburnett marked this pull request as ready for review November 25, 2024 19:47
@zacharyburnett zacharyburnett requested a review from a team as a code owner November 25, 2024 19:47
@zacharyburnett
Copy link
Collaborator Author

zacharyburnett commented Nov 25, 2024

@spacetelescope/crds-maintainers does this look right? The log in the comment above (#1099 (comment)) show the latest context for both the HST and JWST commands in ./setup_test_cache. The context updates should be as follows:

  • hst_1194.pmap -> hst_1195.pmap
  • jwst_1298.pmap -> jwst_1299.pmap

However, the log says this throughout:

0 total-files at    0.0  total-files-per-second

So did it actually update the test cache?

Comment on lines +55 to +65
- if: steps.lookup-cache.outputs.cache-hit != 'true'
id: retrieve-previous-cache
name: retrieve a previous combined CRDS cache
uses: actions/cache/restore@v4
with:
path: |
${{ env.CRDS_PATH }}
${{ env.CRDS_TESTING_CACHE }}
key: ${{ steps.key.outputs.key }}
restore-keys: |
test-cache-
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if a cache with the latest contexts does not exist, attempt to retrieve a previous cache that does exist (with the intent of running ./setup_test_cache /tmp u on it later)

Comment on lines -94 to +91
- if: steps.lookup-combined-cache.outputs.cache-hit != 'true'
run: ./setup_test_cache ${{ env.CRDS_TEST_ROOT }} ${{ (steps.retrieve-hst-cache.outputs.cache-hit == 'true' || steps.retrieve-jwst-cache.outputs.cache-hit == 'true') && 'u' || 'c' }}
- if: steps.lookup-combined-cache.outputs.cache-hit != 'true'
- if: steps.lookup-cache.outputs.cache-hit != 'true'
run: ./setup_test_cache ${{ env.CRDS_TEST_ROOT }} u
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't ever need to run with c here, only u

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

Successfully merging this pull request may close these issues.

1 participant