Skip to content

Commit

Permalink
Merge branch 'tardis-sn:master' into fix#2950
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonu0305 authored Feb 10, 2025
2 parents 4ffd783 + bbe5154 commit a2a8af9
Show file tree
Hide file tree
Showing 35 changed files with 1,485 additions and 302 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ runs:
- name: Generate Cache Key
run: |
file_hash=$(cat conda-${{ inputs.os-label }}.lock | shasum -a 256 | cut -d' ' -f1)
echo "file_hash=$file_hash" >> "${GITHUB_OUTPUT}"
echo "file_hash=tardis-conda-env-${{ inputs.os-label }}-${file_hash}-v1" >> "${GITHUB_OUTPUT}"
id: cache-environment-key
shell: bash

Expand Down
46 changes: 25 additions & 21 deletions .github/actions/setup_lfs/action.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: "Setup LFS"
description: "Pull LFS repositories and caches them"
description: "Sets up Git LFS, retrieves LFS cache and fails if cache is not available"


inputs:
regression-data-repo:
description: "tardis regression data repository"
description: "Repository containing regression data (format: owner/repo)"
required: false
default: "tardis-sn/tardis-regression-data"
atom-data-sparse:
description: "If true, only downloads atom_data/kurucz_cd23_chianti_H_He.h5 instead of full regression data"
required: false
default: 'false'

runs:
using: "composite"
Expand All @@ -16,37 +20,37 @@ runs:
with:
repository: ${{ inputs.regression-data-repo }}
path: tardis-regression-data
sparse-checkout: ${{ inputs.atom-data-sparse == 'true' && 'atom_data/kurucz_cd23_chianti_H_He.h5' || '' }}
lfs: false

- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
run: |
if [ "${{ inputs.atom-data-sparse }}" == "true" ]; then
echo "Using atom data sparse checkout"
echo "atom_data/kurucz_cd23_chianti_H_He.h5" > .lfs-files-list
else
echo "Using full repository checkout"
git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-files-list
fi
working-directory: tardis-regression-data
shell: bash

- name: Restore LFS cache
uses: actions/cache/restore@v4
id: lfs-cache-regression-data
with:
path: tardis-regression-data/.git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-regression-data/.lfs-assets-id') }}-v1
key: tardis-regression-${{ inputs.atom-data-sparse == 'true' && 'atom-data-sparse' || 'full-data' }}-${{ hashFiles('tardis-regression-data/.lfs-files-list') }}-${{ inputs.regression-data-repo }}-v1
fail-on-cache-miss: true

- name: Git LFS Pull
run: git lfs pull
- name: Git LFS Checkout (Full)
if: inputs.atom-data-sparse != 'true' && steps.lfs-cache-regression-data.outputs.cache-hit == 'true'
run: git lfs checkout
working-directory: tardis-regression-data
if: steps.lfs-cache-regression-data.outputs.cache-hit != 'true'
shell: bash

- name: Git LFS Checkout
run: git lfs checkout
- name: Git LFS Checkout (Sparse)
if: inputs.atom-data-sparse == 'true' && steps.lfs-cache-regression-data.outputs.cache-hit == 'true'
run: git lfs checkout atom_data/kurucz_cd23_chianti_H_He.h5
working-directory: tardis-regression-data
if: steps.lfs-cache-regression-data.outputs.cache-hit == 'true'
shell: bash

- name: Save LFS cache if not found
# uses fake ternary
# for reference: https://github.com/orgs/community/discussions/26738#discussioncomment-3253176
if: ${{ steps.lfs-cache-regression-data.outputs.cache-hit != 'true' && !contains(github.ref, 'merge') && always() || false }}
uses: actions/cache/save@v4
id: lfs-cache-regression-data-save
with:
path: tardis-regression-data/.git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-regression-data/.lfs-assets-id') }}-v1
16 changes: 10 additions & 6 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ defaults:
shell: bash -l {0}

jobs:
test-cache:
uses: ./.github/workflows/lfs-cache.yml
with:
atom-data-sparse: false
regression-data-repo: tardis-sn/tardis-regression-data

build:
if: github.repository_owner == 'tardis-sn' &&
(github.event_name == 'push' ||
Expand All @@ -37,6 +43,7 @@ jobs:
(github.event_name == 'pull_request_target' &&
contains(github.event.pull_request.labels.*.name, 'benchmarks')))
runs-on: ubuntu-latest
needs: [test-cache]
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
Expand All @@ -54,13 +61,10 @@ jobs:
run: git fetch origin master:master
if: github.event_name == 'pull_request_target'

- uses: actions/checkout@v4
- name: Setup LFS
uses: ./.github/actions/setup_lfs
with:
repository: tardis-sn/tardis-regression-data
path: tardis-regression-data
lfs: true
sparse-checkout: |
atom_data/kurucz_cd23_chianti_H_He.h5
atom-data-sparse: true

- name: Setup Mamba
uses: mamba-org/setup-micromamba@v1
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ defaults:
shell: bash -l {0}

jobs:
test-cache:
uses: ./.github/workflows/lfs-cache.yml
with:
atom-data-sparse: true
regression-data-repo: tardis-sn/tardis-regression-data

check-for-changes:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
Expand Down Expand Up @@ -77,7 +83,7 @@ jobs:

build-docs:
runs-on: ubuntu-latest
needs: check-for-changes
needs: [test-cache, check-for-changes]
if: needs.check-for-changes.outputs.trigger-check-outcome == 'success' || needs.check-for-changes.outputs.docs-check-outcome == 'success'
steps:
- uses: actions/checkout@v4
Expand All @@ -90,13 +96,10 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
if: github.event_name == 'pull_request_target'

- uses: actions/checkout@v4
- name: Setup LFS
uses: ./.github/actions/setup_lfs
with:
repository: tardis-sn/tardis-regression-data
path: tardis-regression-data
lfs: true
sparse-checkout: |
atom_data/kurucz_cd23_chianti_H_He.h5
atom-data-sparse: true

- name: Setup environment
uses: ./.github/actions/setup_env
Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/lfs-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Save LFS Cache

on:
workflow_call:
inputs:
atom-data-sparse:
description: "If true, only downloads atom_data/kurucz_cd23_chianti_H_He.h5"
required: false
default: false
type: boolean
regression-data-repo:
description: "Repository containing regression data (format: owner/repo)"
required: false
default: "tardis-sn/tardis-regression-data"
type: string

defaults:
run:
shell: bash -l {0}

concurrency:
# Only one workflow can run at a time
# the workflow group is a unique identifier and contains the workflow name, pull request number, atom data sparse, and regression data repo
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ inputs.atom-data-sparse == 'true' && 'atom-data-sparse' || 'full-data' }}-${{ inputs.regression-data-repo }}
cancel-in-progress: true


jobs:
lfs-cache:
if: github.repository_owner == 'tardis-sn'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: ${{ inputs.regression-data-repo }}
path: tardis-regression-data
sparse-checkout: ${{ inputs.atom-data-sparse == 'true' && 'atom_data/kurucz_cd23_chianti_H_He.h5' || '' }}

- name: Create LFS file list
run: |
if [ "${{ inputs.atom-data-sparse }}" == "true" ]; then
echo "Using atom data sparse checkout"
echo "atom_data/kurucz_cd23_chianti_H_He.h5" > .lfs-files-list
else
echo "Using full repository checkout"
git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-files-list
fi
working-directory: tardis-regression-data


- name: Test cache availability
uses: actions/cache/restore@v4
id: test-lfs-cache-regression-data
with:
path: tardis-regression-data/.git/lfs
key: tardis-regression-${{ inputs.atom-data-sparse == 'true' && 'atom-data-sparse' || 'full-data' }}-${{ hashFiles('tardis-regression-data/.lfs-files-list') }}-${{ inputs.regression-data-repo }}-v1
lookup-only: true

- name: Git LFS Pull Atom Data
run: git lfs pull --include=atom_data/kurucz_cd23_chianti_H_He.h5
if: ${{ inputs.atom-data-sparse == true && steps.test-lfs-cache-regression-data.outputs.cache-hit != 'true' }}
working-directory: tardis-regression-data

- name: Git LFS Pull Full Data
run: git lfs pull
if: ${{ inputs.atom-data-sparse == false && steps.test-lfs-cache-regression-data.outputs.cache-hit != 'true' }}
working-directory: tardis-regression-data

- name: Git LFS Checkout
if: ${{ inputs.atom-data-sparse == 'true' }}
run: git lfs checkout atom_data/kurucz_cd23_chianti_H_He.h5
working-directory: tardis-regression-data

- name: Git LFS Checkout Full
if: ${{ inputs.atom-data-sparse == 'false' }}
run: git lfs checkout
working-directory: tardis-regression-data

- name: Save LFS cache if not found
uses: actions/cache/save@v4
if: ${{ steps.test-lfs-cache-regression-data.outputs.cache-hit != 'true' && !contains(github.ref, 'merge') }}
with:
path: tardis-regression-data/.git/lfs
key: tardis-regression-${{ inputs.atom-data-sparse == true && 'atom-data-sparse' || 'full-data' }}-${{ hashFiles('tardis-regression-data/.lfs-files-list') }}-${{ inputs.regression-data-repo }}-v1
7 changes: 7 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,16 @@ concurrency:
cancel-in-progress: true

jobs:
test-cache:
uses: ./.github/workflows/lfs-cache.yml
with:
atom-data-sparse: false
regression-data-repo: tardis-sn/tardis-regression-data

tests:
name: ${{ matrix.continuum }} continuum ${{ matrix.os }} ${{ inputs.pip_git && 'pip tests enabled' || '' }}
if: github.repository_owner == 'tardis-sn'
needs: [test-cache]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
## Changelog

### release-2025.01.12 (2025/01/11 20:04)
### release-2025.01.26 (2025/01/25 20:04)
- [2932](https://github.com/tardis-sn/tardis/pull/2932) opacity_state_to_numba -> to_numba and moved to as a method of class OpacityState (2932) (@Sonu0305)
- [2897](https://github.com/tardis-sn/tardis/pull/2897) Ionization rates (2897) (@andrewfullard)
- [2938](https://github.com/tardis-sn/tardis/pull/2938) Fixes spelling errors in the codebase (2938) (@Sonu0305)
- [2952](https://github.com/tardis-sn/tardis/pull/2952) Post-release 2025.01.19 (2952) (@tardis-bot)
### release-2025.01.19 (2025/01/14 16:54)
- [2800](https://github.com/tardis-sn/tardis/pull/2800) V inner formal integral (2800) (@Rodot-)
- [2946](https://github.com/tardis-sn/tardis/pull/2946) Fixes indentation for tracking key to be nested under montecarlo key in YAML (2946) (@Sonu0305)
- [2907](https://github.com/tardis-sn/tardis/pull/2907) Add missing init.py file in opacitites module (2907) (@KasukabeDefenceForce)
- [2922](https://github.com/tardis-sn/tardis/pull/2922) Fixed data download link mentioned under Quickstart for TARDIS (2922) (@Sonu0305)
- [2908](https://github.com/tardis-sn/tardis/pull/2908) Ignore ipynb files in codespell (2908) (@KasukabeDefenceForce)
- [2943](https://github.com/tardis-sn/tardis/pull/2943) Post-release 2025.01.12 (2943) (@tardis-bot)
### release-2025.01.12 (2025/01/09 03:46)
- [2925](https://github.com/tardis-sn/tardis/pull/2925) give tag in git cliff command (2925) (@KasukabeDefenceForce)
- [2923](https://github.com/tardis-sn/tardis/pull/2923) Moves non-physical input check outsode I/O module (2923) (@Sonu0305)
- [2924](https://github.com/tardis-sn/tardis/pull/2924) Post-release 2025.01.05 (2924) (@tardis-bot)
Expand Down
8 changes: 4 additions & 4 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
cff-version: 1.0.3
message: If you use this software, please cite it using these metadata.
# FIXME title as repository name might not be the best name, please make human readable
title: 'tardis-sn/tardis: TARDIS v2025.01.12'
doi: 10.5281/zenodo.14633332
title: 'tardis-sn/tardis: TARDIS v2025.01.26'
doi: 10.5281/zenodo.14740815
# FIXME splitting of full names is error prone, please check if given/family name are correct
authors:
- given-names: Wolfgang
Expand Down Expand Up @@ -347,7 +347,7 @@ authors:
- given-names: Atharwa
family-names: Kharkar
affiliation:
version: release-2025.01.12
date-released: 2025-01-12
version: release-2025.01.26
date-released: 2025-01-26
repository-code: https://github.com/tardis-sn/tardis
license: cc-by-4.0
16 changes: 8 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ The following BibTeX entries are needed for the references:
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
.. |CITATION| replace:: kerzendorf_2025_14633332
.. |CITATION| replace:: kerzendorf_2025_14740815

.. |DOI_BADGE| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.14633332-blue
:target: https://doi.org/10.5281/zenodo.14633332
.. |DOI_BADGE| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.14740815-blue
:target: https://doi.org/10.5281/zenodo.14740815

.. code-block:: bibtex
@software{kerzendorf_2025_14633332,
@software{kerzendorf_2025_14740815,
author = {Kerzendorf, Wolfgang and
Sim, Stuart and
Vogl, Christian and
Expand Down Expand Up @@ -225,13 +225,13 @@ The following BibTeX entries are needed for the references:
Nayak U, Ashwin and
Kumar, Atul and
Kharkar, Atharwa},
title = {tardis-sn/tardis: TARDIS v2025.01.12},
title = {tardis-sn/tardis: TARDIS v2025.01.26},
month = jan,
year = 2025,
publisher = {Zenodo},
version = {release-2025.01.12},
doi = {10.5281/zenodo.14633332},
url = {https://doi.org/10.5281/zenodo.14633332},
version = {release-2025.01.26},
doi = {10.5281/zenodo.14740815},
url = {https://doi.org/10.5281/zenodo.14740815},
}
*******
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/development/benchmarks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Set up
======

In this step, ASV configures TARDIS through Mamba.
Packages that use TARIDS are downloaded here.
Packages that use TARDIS are downloaded here.
These packages are mainly found in this ``tardis_env3.yml`` file.
The environment is also configured for ASV to execute benchmarks
and store the results through the ``asv.conf.json`` file.
Expand Down
24 changes: 24 additions & 0 deletions docs/contributing/development/continuous_integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,30 @@ TARDIS Pipelines

Brief description of pipelines already implemented on TARDIS

Cache Keys in TARDIS CI
-----------------------

TARDIS uses specific cache key formats to efficiently store and retrieve data during CI runs:

1. **Regression Data Cache Keys**
- Format: ``tardis-regression-<data-type>-<hash>-v1``
- Examples:
- ``tardis-regression-atom-data-sparse-<hash>-v1`` - For atomic data cache
- ``tardis-regression-full-data-<hash>-v1`` - For full TARDIS regression data cache
- Used in: ``setup_lfs`` action

2. **Environment Cache Keys**
- Format: ``tardis-conda-env-<os-label>-<hash>-v1``
- Examples:
- ``tardis-conda-env-linux-<hash>-v1`` - For Linux conda environment
- ``tardis-conda-env-macos-<hash>-v1`` - For macOS conda environment
- Used in: ``setup_env`` action

.. warning::
- The version suffix (-v1) allows for future cache invalidation if needed.
- Sometimes the cache might not be saved due to race conditions between parallel jobs. Please check workflow runs when testing new regression data for cache misses to avoid consuming LFS quota.


Streamlined Steps for TARDIS Pipelines
========================================

Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/development/running_tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Or, to run tests for a particular file or directory
To prevent leaking LFS quota, tests have been disabled on forks.
If, by any chance, you need to run tests on your fork, make sure to run the tests workflow on master branch first.
The LFS cache generated in the master branch should be available in all child branches.
You can check if cache was generated by looking in the ``Restore LFS Cache`` step of the workflow run.
You can check if cache was generated by looking in the ``Setup LFS`` step of the workflow run.
Cache can also be found under the "Management" Section under "Actions" tab.

Generating Plasma Reference
Expand Down
Loading

0 comments on commit a2a8af9

Please sign in to comment.