Skip to content

Cache rubin-sim-data #32

Cache rubin-sim-data

Cache rubin-sim-data #32

Workflow file for this run

name: Cache rubin-sim-data
on:
# Run job at the end of each day
schedule:
- cron: "0 0 * * *"
# and on manual workflow
workflow_dispatch:
jobs:
make-cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.11"
auto-update-conda: true
channels: conda-forge,defaults
miniforge-variant: Mambaforge
use-mamba: true
channel-priority: strict
show-channel-urls: true
activate-environment: rubin-sim
- name: Install rubin-sim
id: rs-install
shell: bash -l {0}
run: |
mamba install --quiet rubin_sim
mamba list rubin-sim | grep -v "#" | awk '{print $2}' > ${{ github.workspace }}/rs_version
echo "rs-version" `cat ${{ github.workspace }}/rs_version`
echo "rs-version=`cat ${{ github.workspace }}/rs_version`" >> $GITHUB_OUTPUT
- name: Access rubin-sim-data cache
id: cache-rs
uses: actions/cache@v3
env:
cache-name: cached-rubin-sim-data
with:
path: ~/rubin_sim_data
key: ${{ env.cache-name }}-v${{ steps.rs-install.outputs.rs-version }}
restore-keys: |
${{ env.cache-name }}-v
- if: ${{ steps.cache-rs.outputs.cache-hit == 'true' }}
name: List cache contents.
shell: bash -l {0}
run: |
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data
echo $RUBIN_SIM_DATA_DIR contents
ls $RUBIN_SIM_DATA_DIR
echo "__contents of versions.txt__"
cat $RUBIN_SIM_DATA_DIR/versions.txt
- if: ${{ steps.cache-rs.outputs.cache-hit != 'true' }}
name: Download data.
shell: bash -l {0}
run: |
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data
rs_download_data --force --dirs scheduler,site_models,skybrightness_pre,throughputs,tests --tdqm_disable
- name: Check data
shell: bash -l {0}
run: |
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data
echo $RUBIN_SIM_DATA_DIR contents
ls $RUBIN_SIM_DATA_DIR
echo "__contents of versions.txt__"
cat $RUBIN_SIM_DATA_DIR/versions.txt