Merge pull request #54 from ccmmf/events-update #3
This file contains hidden or 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
| name: Test Example 3 (Apptainer) | |
| # Runs the 3 row crop example end-to-end using the workflow Apptainer container | |
| # for all R steps, with Slurm dispatch for ensemble members. | |
| # A pre-built pecan-all conda environment is still needed for the non-R | |
| # (magic-ensemble) steps. This workflow does not build it — it must already | |
| # exist at $RUNNER_TOOL_CACHE/pecan-all-<version> on the runner. | |
| # Requires a self-hosted runner with Slurm and apptainer on PATH (or via module). | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| pecan_env_version: | |
| description: 'pecan-all conda env version (e.g. 1.16)' | |
| default: '1.16' | |
| required: false | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'examples/3_rowcrop/**' | |
| - 'workflow/**' | |
| - 'tools/**' | |
| - 'magic-ensemble' | |
| - '.github/workflows/test-example-3-apptainer.yml' | |
| - '.github/ci/example_3_apptainer_config.yaml' | |
| - '.github/ci/site_info_3.csv' | |
| env: | |
| PECAN_ENV_VERSION: ${{ github.event.inputs.pecan_env_version || '1.16' }} | |
| CONFIG: .github/ci/example_3_apptainer_config.yaml | |
| jobs: | |
| run: | |
| name: 3 Row Crop (apptainer, Slurm) | |
| runs-on: self-hosted | |
| timeout-minutes: 480 | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_DEFAULT_REGION: garage | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: false | |
| - name: Load apptainer module | |
| run: module load apptainer | |
| - name: Locate conda environment | |
| run: | | |
| PECAN_ENV_PATH="${RUNNER_TOOL_CACHE}/pecan-all-${PECAN_ENV_VERSION}" | |
| if [[ ! -d "${PECAN_ENV_PATH}" ]]; then | |
| echo "::error::No pecan-all conda environment found for version ${PECAN_ENV_VERSION} at ${PECAN_ENV_PATH}." | |
| echo "Set it up there before dispatching this workflow with pecan_env_version=${PECAN_ENV_VERSION}." | |
| exit 1 | |
| fi | |
| echo "Using pecan-all ${PECAN_ENV_VERSION} at ${PECAN_ENV_PATH}" | |
| echo "PECAN_ENV_PATH=${PECAN_ENV_PATH}" >> "$GITHUB_ENV" | |
| echo "RETICULATE_PYTHON=${PECAN_ENV_PATH}/bin/python" >> "$GITHUB_ENV" | |
| - name: Get demo data | |
| run: | | |
| set +u | |
| eval "$(conda shell.bash hook)" | |
| conda activate "${PECAN_ENV_PATH}" | |
| set -u | |
| ./magic-ensemble get-demo-data --verbose --config "$CONFIG" | |
| - name: Prepare | |
| run: | | |
| set +u | |
| eval "$(conda shell.bash hook)" | |
| conda activate "${PECAN_ENV_PATH}" | |
| set -u | |
| ./magic-ensemble prepare-example-3 --verbose --config "$CONFIG" | |
| - name: Run ensembles | |
| run: | | |
| set +u | |
| eval "$(conda shell.bash hook)" | |
| conda activate "${PECAN_ENV_PATH}" | |
| set -u | |
| ./magic-ensemble run-ensembles --verbose --config "$CONFIG" | |
| - name: Cleanup | |
| if: always() | |
| run: rm -rf ci-3-apptainer-rundir |