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

Fixes for reference data pipeline #1242

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ac74f8d
Fetch only necessary refdata files
epassaro Jul 18, 2020
3c0dfe6
Multiple changes to variable names
epassaro Jul 18, 2020
2d3ec95
Add exit on fail (bash) step
epassaro Jul 18, 2020
80512f8
Minor changes
epassaro Jul 18, 2020
90ca3f5
Trigger build
epassaro Jul 18, 2020
e9e9f64
Fix typo
epassaro Jul 18, 2020
aee67fe
Use pytest instead astropy helpers
epassaro Jul 18, 2020
86de816
Minor changes
epassaro Jul 18, 2020
24ff70c
Minor changes
epassaro Jul 18, 2020
6321d75
Fix typo
epassaro Jul 18, 2020
4322b22
Debug problem with atom data
epassaro Jul 18, 2020
97d2922
Debug problem with atom data (2)
epassaro Jul 18, 2020
62e9820
Debug problem with atom data (3)
epassaro Jul 18, 2020
4c965ea
Debug problem with atom data (4)
epassaro Jul 18, 2020
e817f12
Debug problem with atom data (5)
epassaro Jul 18, 2020
305be73
Debug problem with atom data (6)
epassaro Jul 18, 2020
80c8085
Add `PACKAGE_MANAGER` variable
epassaro Jul 18, 2020
74c42dd
Debug problem with atom data (7)
epassaro Jul 18, 2020
3a40534
Debug problem with atom data (8)
epassaro Jul 18, 2020
e7ece1f
Debug problem with atom data (9)
epassaro Jul 18, 2020
c513676
Debug problem with atom data (10)
epassaro Jul 18, 2020
5ef3218
Minor changes
epassaro Jul 18, 2020
74cfd54
Minor changes (2)
epassaro Jul 18, 2020
12e6844
Fix typo
epassaro Jul 18, 2020
00f7e79
Test quotes
epassaro Jul 18, 2020
707d23f
Test Azure variables
epassaro Jul 18, 2020
9f5f2a3
Test Azure variables (2)
epassaro Jul 19, 2020
113af0d
Test Azure variables (2)
epassaro Jul 19, 2020
ce32722
Test Azure variables (3)
epassaro Jul 19, 2020
163078e
Render notebook if failed
epassaro Jul 19, 2020
a0222a3
Render notebook if failed (2)
epassaro Jul 19, 2020
98b67a7
Render notebook if failed (3)
epassaro Jul 19, 2020
5e37c49
Remove innecessary lines
epassaro Jul 19, 2020
d7168a0
Add debug step
epassaro Jul 19, 2020
f0af1da
Rename remote
epassaro Jul 19, 2020
1434c8d
Rename remote (2)
epassaro Jul 19, 2020
02fce37
Rename remote (3)
epassaro Jul 19, 2020
91ce22e
Pin bokeh to 1.4
epassaro Jul 20, 2020
4f27932
Add checkout step
epassaro Jul 20, 2020
f85ba93
Add checkout step (2)
epassaro Jul 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 47 additions & 37 deletions azure-pipelines/compare-refdata.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
# Keep this line, is useful for testing without changing the notebook.
# sed -i "s/ref2_hash='upstream\/pr\/24'/ref1_hash='c998f44', ref2_hash='master'/g" ref_data_compare.ipynb

# This pipeline runs manually
trigger: none
pr: none
pr: [ master ]

variables:
system.debug: "true"
ref.data.home: "$(Agent.BuildDirectory)/tardis-refdata"
ref.data.github.url: "https://github.com/tardis-sn/tardis-refdata.git"
tardis.build.dir: $(Build.Repository.LocalPath)
package.manager: "mamba"
build.dir: "$(Agent.BuildDirectory)"
ref.data.url: "https://github.com/tardis-sn/tardis-refdata.git"
ref.data.dir: "$(build.dir)/tardis-refdata"
system.debug: "false"

jobs:
- job: report
pool:
vmImage: "ubuntu-latest"

steps:
- bash: |
echo "##vso[task.prependpath]$CONDA/bin"
sudo chown -R $USER $CONDA
displayName: "Add CONDA to path"
- bash: echo "##vso[task.setvariable variable=shellopts]errexit"
displayName: "Force exit on error (bash)"

- bash: |
sh ci-helpers/install_tardis_env.sh
displayName: "Install TARDIS env"
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: "Add conda to path"

- bash: |
source activate tardis
conda install bokeh -c conda-forge --no-update-deps --yes
displayName: "Install Bokeh"
- bash: conda install mamba -c conda-forge -y
displayName: "Install Mamba package manager"
condition: eq(variables['package.manager'], 'mamba')

- bash: $PACKAGE_MANAGER env create -f tardis_env3.yml
displayName: "Install TARDIS environment"

- bash: |
source activate tardis
git clone https://github.com/tardis-sn/tardis-refdata.git $(ref.data.home)
displayName: "Fetch ALL reference data"
$PACKAGE_MANAGER install bokeh=1.4 -c conda-forge --no-update-deps -y
displayName: "Install Bokeh in TARDIS environment"

- bash: sh ci-helpers/fetch_reference_data.sh
displayName: "Fetch reference data"

- bash: |
source activate tardis
Expand All @@ -44,30 +46,38 @@ jobs:

- bash: |
source activate tardis
python setup.py test --args="--tardis-refdata=$(ref.data.home) --generate-reference"
pytest tardis --tardis-refdata=$REF_DATA_DIR --generate-reference
displayName: "Generate new reference data"

- bash: |
source activate tardis
cd $(ref.data.home)
git remote add upstream https://github.com/tardis-sn/tardis-refdata.git
git fetch upstream
cd $REF_DATA_DIR
git fetch upstream "+refs/pull/*/head:refs/remotes/upstream/pr/*"
cd notebooks
git checkout upstream/pr/28
git lfs pull --include="unit_test_data.h5" upstream
displayName: "Checkout"

- bash: |
source activate tardis
cd $REF_DATA_DIR/notebooks
jupyter nbconvert ref_data_compare.ipynb --to html --execute --ExecutePreprocessor.timeout=6000
displayName: "Generating HTML report"

- bash: |
source activate tardis
cd $REF_DATA_DIR/notebooks
jupyter nbconvert ref_data_compare.ipynb --to html --execute --allow-errors --ExecutePreprocessor.timeout=6000
displayName: "Generating report"
displayName: "Generating (failed) HTML report"
condition: failed()

- task: PublishPipelineArtifact@1
inputs:
targetPath: "$(ref.data.home)/notebooks/ref_data_compare.html"
artifact: "report"
targetPath: "$(ref.data.dir)/notebooks/ref_data_compare.html"
artifact: "html_report"
publishLocation: "pipeline"

- bash: |
ls -lR /tmp
echo
displayName: "Publishing artifact"
condition: succeededOrFailed()
displayName: "Check files in /tmp"

# Keep this line, is useful for testing without changing the notebook.
# sed -i "s/ref2_hash='upstream\/pr\/24'/ref1_hash='c998f44', ref2_hash='master'/g" ref_data_compare.ipynb
- bash: ls -lR /tmp
displayName: "Check files in /tmp"
condition: succeededOrFailed()
44 changes: 26 additions & 18 deletions ci-helpers/fetch_reference_data.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
#!/usr/bin/env bash
git lfs install --skip-smudge

if test -e $REF_DATA_HOME; then
echo "Ref data available"
if test -e $REF_DATA_DIR; then
echo "Reference data available"

else
echo git clone $REF_DATA_GITHUB_URL $REF_DATA_HOME
git clone $REF_DATA_GITHUB_URL $REF_DATA_HOME

cd $REF_DATA_HOME
# Use the following to get the ref-data from the master;
git fetch origin
git checkout origin/master
# Use the following to get the ref-data from a specific pull request
#git fetch origin pull/20/head:update-ref
#git checkout update-ref
git lfs pull --include="atom_data/kurucz_cd23_chianti_H_He.h5" origin
git lfs pull --include="atom_data/chianti_He.h5" origin
git lfs pull --include="plasma_reference/" origin
git lfs pull --include="unit_test_data.h5" origin
echo MD5 `md5sum unit_test_data.h5`; fi
cd $TARDIS_BUILD_DIR
git clone $REF_DATA_URL $REF_DATA_DIR -o upstream
cd $REF_DATA_DIR

# Use the following to get the ref-data from the master;
git fetch upstream
git checkout upstream/master

# Use the following to get the ref-data from a specific pull request
# git fetch upstream pull/20/head:update-ref
# git checkout update-ref

git lfs pull --include="atom_data/kurucz_cd23_chianti_H_He.h5" upstream
git lfs pull --include="atom_data/chianti_He.h5" upstream
git lfs pull --include="plasma_reference/" upstream
git lfs pull --include="unit_test_data.h5" upstream
git lfs pull --include="packet_unittest.h5" upstream

echo MD5: `md5sum unit_test_data.h5`
echo MD5: `md5sum atom_data/kurucz_cd23_chianti_H_He.h5`

fi

exit 0