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

catalog builder pkg usage updates #7

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 20 additions & 10 deletions .github/workflows/ci-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,34 @@ jobs:
strategy:
max-parallel: 5
matrix:
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.9']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
cd analysis-scripts; pip install .; cd ..
cd figure_tools; pip install .; cd ..
cd freanalysis; pip install .; cd ..
cd freanalysis_clouds; pip install .; cd ..
git clone https://github.com/aradhakrishnanGFDL/CatalogBuilder catalogbuilder
cd catalogbuilder; pip install .; cd ..
pip install pytest
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
conda config --add channels noaa-gfdl
conda config --append channels conda-forge
conda create --name analysis-script-testing
conda install -n analysis-script-testing catalogbuilder -c noaa-gfdl
#conda activate analysis-script-testing
conda install pip
cd analysis-scripts
$CONDA/envs/analysis-script-testing/bin/python -m pip install .; cd ..
cd figure_tools
$CONDA/envs/analysis-script-testing/bin/python -m pip install .; cd ..
cd freanalysis
$CONDA/envs/analysis-script-testing/bin/python -m pip install .; cd ..
cd freanalysis_clouds
$CONDA/envs/analysis-script-testing/bin/python -m pip install .; cd ..

- name: Test freanalysis_clouds
run: |
python3 -m pytest tests
$CONDA/envs/analysis-script-testing/bin/pytest tests
7 changes: 4 additions & 3 deletions tests/test_freanalysis_clouds.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from tempfile import TemporaryDirectory

from freanalysis.plugins import list_plugins, plugin_requirements, run_plugin
from scripts import gen_intake_gfdl

import catalogbuilder
from catalogbuilder.scripts import gen_intake_gfdl

def download_test_data(stem):
"""Downloads test datasets from a FTP server.
Expand Down Expand Up @@ -47,7 +47,8 @@ def create_data_catalog(path, output="data-catalog"):
yaml_path = Path(__file__).resolve().parent / "mdtf_timeslice_catalog.yaml"

# Hack to stop click from exiting.
command = ["python3", "-m", "scripts.gen_intake_gfdl", str(path), output,
# TODO we have to move create catalog as its own pytest in the conda environment perhaps, and avoid this hardcoding
command = ["/usr/share/miniconda/envs/analysis-script-testing/bin/python", "-m", "catalogbuilder.scripts.gen_intake_gfdl", str(path), output,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When @ilaflott was digging into github CI pipelines last week, he found that one cannot run "conda activate" in the pipeline steps. I didn't understand why.. but you're clearly seeing the same rhing, as you have the conda activate commented out, and then use that python's path later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's kinda murky with the init file set up perhaps. We can however activate it, but have to use something like https://github.com/marketplace/actions/setup-miniconda. However, the new pipeline (see new PR) will use the new changes in the catalogbuilder and we will no longer need this particular line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still want this PR? Sorry for leaving this hanging here. The hard-coded path to the python here would only be used in the CI environments in practice so we could live with it.

"--config", str(yaml_path)]
run(command, check=True)
return Path(f"{output}.json").resolve(), Path(f"{output}.csv").resolve()
Expand Down
Loading