-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change webbpsf data caching in github CI
download webbpsf data once per week to update a cache ``webbpsf-<hash>`` that can be used as a ``cache-restore-keys`` entry for the cache in other ci jobs. This can also be triggered when a PR is specifically labeled to update webbpsf data. Update other ``roman_ci.yml`` to use most recent ``webbpsf-<hash>`` to look up hash to then construct a combined cache key (for the combined crds/webbpsf data cache) using the webbpsf data as a restore key to initialize the cache with the pre-fetched webbpsf data. ``roman_ci_cron.yml`` will need similar updates.
- Loading branch information
Showing
2 changed files
with
68 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: check/update webbpsf cache | ||
|
||
on: | ||
schedule: | ||
- cron: "42 4 * * 3" | ||
pull_request: | ||
# We also want this workflow triggered if the `update webbpsf data` label is | ||
# added or present when PR is updated | ||
types: | ||
- opened | ||
- reopened | ||
- labeled | ||
- unlabeled | ||
- synchronize | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
webbpsf-data: | ||
if: (github.repository == 'spacetelescope/romancal' && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'update webbpsf data'))) | ||
name: fetch, check, and possibly update WEBBPSF data cache | ||
runs-on: ubuntu-latest | ||
env: | ||
# DATA_PATH here should match CRDS_PATH in roman_ci.yml and roman_ci_cron.yml | ||
DATA_PATH: /tmp/data | ||
WEBBPSF_DATA_URL: https://stsci.box.com/shared/static/qxpiaxsjwo15ml6m4pkhtk36c9jgj70k.gz | ||
outputs: | ||
path: ${{ steps.cache_path.outputs.path }} | ||
hash: ${{ steps.data_hash.outputs.hash }} | ||
steps: | ||
- id: cache_path | ||
run: | | ||
echo "path=${{ env.DATA_PATH }}" >> $GITHUB_OUTPUT | ||
- id: data_hash | ||
run: | | ||
mkdir -p tmp/data | ||
wget ${{ env.WEBBPSF_DATA_URL }} -O tmp/webbpsf-data.tar.gz | ||
echo "hash=$( shasum tmp/webbpsf-data.tar.gz | cut -d ' ' -f 1 )" >> $GITHUB_OUTPUT | ||
- id: cache_check | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.cache_path.outputs.path }} | ||
key: webbpsf-${{ steps.data_hash.outputs.hash }} | ||
- if: ${{ steps.cache_check.outputs.cache-hit != 'true' }} | ||
name: Initialize cache | ||
run: | | ||
mkdir -p ${{ steps.cache_path.outputs.path }} | ||
tar -xzvf tmp/webbpsf-data.tar.gz -C ${{ steps.cache_path.outputs.path }} |