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

Aradhakrishnan gfdl build test #1

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b3ee120
Update environment.yml
ilaflott Jul 23, 2024
aab9702
Update environment.yml
ilaflott Jul 23, 2024
6cd38e8
Update and rename python-conda-env.yml to python-conda-conda-env-crea…
ilaflott Jul 23, 2024
ec12d52
Rename python-conda-conda-env-create-pip-install-pytest to python-con…
ilaflott Jul 23, 2024
bc171fd
Update and rename python-conda-conda-env-create-pip-install-pytest.ym…
ilaflott Jul 23, 2024
ba59474
Delete .github/workflows/import-test.yml
ilaflott Jul 23, 2024
ea833e1
Delete .github/workflows/main.yml
ilaflott Jul 23, 2024
84fa764
Update documentation.yml
ilaflott Jul 23, 2024
a2c917a
Delete .github/workflows/docker-image2.yml
ilaflott Jul 23, 2024
f4ab697
Delete .github/workflows/docker-image.yml
ilaflott Jul 23, 2024
dd5b547
Update publish-conda.yml
ilaflott Jul 23, 2024
64fd76e
Create build-conda.yml
ilaflott Jul 23, 2024
14b409e
Delete tests/__pycache__ directory
ilaflott Jul 23, 2024
cca61f0
Update build-conda.yml
ilaflott Jul 23, 2024
9d700c5
Update publish-conda.yml
ilaflott Jul 23, 2024
95e3a30
Update build-conda.yml
ilaflott Jul 23, 2024
276517b
Update meta.yaml
ilaflott Jul 23, 2024
8d1e85f
Update meta.yaml
ilaflott Jul 23, 2024
11921a3
Update meta.yaml
ilaflott Jul 23, 2024
984ec95
Update conda-env-create-and-pytest.yml
ilaflott Jul 23, 2024
1c29cc0
Update conda-env-create-and-pytest.yml
ilaflott Jul 23, 2024
5b971ad
Update conda-env-create-and-pytest.yml
ilaflott Jul 23, 2024
8692ee6
Update publish-conda.yml
ilaflott Jul 23, 2024
42d1c44
Update conda-env-create-and-pytest.yml
ilaflott Jul 23, 2024
6bdcf79
Delete .github/workflows/create-gfdl-catalog.yml
ilaflott Jul 23, 2024
6ee1781
Update conda-env-create-and-pytest.yml
ilaflott Jul 24, 2024
83a93ea
Update conda-env-create-and-pytest.yml
ilaflott Jul 24, 2024
0e1ffe0
Update conda-env-create-and-pytest.yml
ilaflott Jul 24, 2024
09ca85e
Update MANIFEST.in
ilaflott Jul 24, 2024
01ac1e8
move tests directory into catalogbuilder- as the tests/ dir is still …
ilaflott Jul 24, 2024
332bcb0
did i fix the packaging??? i might have fixed the packaging. or at le…
ilaflott Jul 24, 2024
bd0f8f9
change path in test_ingestion.py
ilaflott Jul 24, 2024
fc6457c
SO CLOSE
ilaflott Jul 24, 2024
a786155
last path needed to be fixed?
ilaflott Jul 24, 2024
a635910
edit doc to reflect 'intakebuilder' --> 'catalogbuilder' package name…
ilaflott Jul 24, 2024
d40c0be
Update and rename conda-env-create-and-pytest.yml to conda-env-create…
ilaflott Jul 24, 2024
786baf3
Update build-conda.yml
aradhakrishnanGFDL Jul 25, 2024
6092729
Update build-conda.yml
aradhakrishnanGFDL Jul 25, 2024
f788597
Update build-conda.yml
aradhakrishnanGFDL Jul 25, 2024
0c24ef5
Update build-conda.yml
aradhakrishnanGFDL Jul 25, 2024
c49d7af
Update build-conda.yml
aradhakrishnanGFDL Jul 25, 2024
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
25 changes: 25 additions & 0 deletions .github/workflows/build-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: build_conda
on:
pull_request:
branches:
# for testing conda build w no upload during PRs
- main
jobs:
build:
runs-on: ubuntu-latest
container:
image: continuumio/miniconda3:latest
steps:
- name: Checkout Files
uses: actions/checkout@v4
- name: Run Docker to Build
run: |
conda config --append channels conda-forge
conda config --append channels noaa-gfdl
conda install conda-build conda-verify
conda build .
- name: Import Test with pytest
run: |
conda create --name catalogbuildertest
conda install -n catalogbuildertest catalogbuilder --use-local
/opt/conda/envs/catalogbuildertest/bin/pytest catalogbuilder
76 changes: 76 additions & 0 deletions .github/workflows/conda-env-create-run-pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: conda-env-create-run-pytest

on: [pull_request]

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH

- name: Create catalogbuilder conda environment
run: |
# create environment catalogbuilder will be installed into
conda env create -f environment.yml --name catalogbuilder
# put conda env binaries in GITHUB_PATH
echo $CONDA/envs/catalogbuilder/bin >> $GITHUB_PATH
# install catalogbuilder to conda env directories
$CONDA/envs/catalogbuilder/bin/python -m pip install --prefix $CONDA/envs/catalogbuilder .

- name: Run pytest in catalogbuilder conda environment
run: |
which python
python --version
$CONDA/envs/catalogbuilder/bin/python --version
# which pytest
$CONDA/envs/catalogbuilder/bin/pytest catalogbuilder

- name: Make sample data
run: |
which python
python catalogbuilder/tests/make_sample_data.py

- name: Generate catalog
run: |
which python
python catalogbuilder/scripts/gen_intake_gfdl.py archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp gfdl_autotest

- name: Generate catalog with yaml
run: |
which python
python catalogbuilder/scripts/gen_intake_gfdl.py --config catalogbuilder/tests/test_config.yaml

- name: upload-artifacts
uses: actions/upload-artifact@v4
with:
name: workflow-artifacts1
path: |
gfdl_autotest.csv
gfdl_autotest.json
cats/gfdl_autotest_from_yaml.csv
cats/gfdl_autotest_from_yaml.json

- name: Download all workflow run artifacts
uses: actions/download-artifact@v4

- name: Run pytest with downloaded artifacts
run: |
$CONDA/envs/catalogbuilder/bin/pytest -v --runxfail catalogbuilder

- name: Test for completeness
run: |
which python
python catalogbuilder/scripts/test_catalog.py -tf gfdl_autotest.json catalogbuilder/cats/gfdl_template.json
python catalogbuilder/scripts/test_catalog.py -tf catalogbuilder/cats/gfdl_autotest_from_yaml.json
54 changes: 0 additions & 54 deletions .github/workflows/create-gfdl-catalog.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/docker-image.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/docker-image2.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3

- name: Install dependencies
run: |
pip install sphinx sphinx_rtd_theme myst_parser piccolo_theme

- name: Sphinx build
run: |
sphinx-build doc _build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/import-test.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/main.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/publish-conda.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: publish_conda
on:
pull_request:
push:
branches:
#for testing the restructuring, back on push only later.
# only upload upon MR acceptance.
- main
jobs:
build_and_publish:
publish:
runs-on: ubuntu-latest
container:
image: continuumio/miniconda3:latest
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/python-conda-env.yml

This file was deleted.

2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
recursive-include cats *
recursive-include catalogbuilder/cats *

3 changes: 2 additions & 1 deletion catalogbuilder/intakebuilder/CSVwriter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os.path
import csv
from csv import writer
from intakebuilder import builderconfig, configparser
#from intakebuilder import builderconfig, configparser
from . import builderconfig, configparser

def getHeader(configyaml):
'''
Expand Down
3 changes: 2 additions & 1 deletion catalogbuilder/intakebuilder/getinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from csv import writer
import os
import xarray as xr
from intakebuilder import builderconfig, configparser
#from intakebuilder import builderconfig, configparser
from . import builderconfig, configparser


'''
Expand Down
3 changes: 2 additions & 1 deletion catalogbuilder/intakebuilder/gfdlcrawler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from intakebuilder import getinfo, builderconfig
#from intakebuilder import getinfo, builderconfig
from . import getinfo, builderconfig
import sys
import re
import operator as op
Expand Down
3 changes: 2 additions & 1 deletion catalogbuilder/intakebuilder/localcrawler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from intakebuilder import getinfo
#from intakebuilder import getinfo
from . import getinfo
import re
'''
localcrawler crawls through the local file path, then calls helper functions in the package to getinfo.
Expand Down
3 changes: 2 additions & 1 deletion catalogbuilder/intakebuilder/s3crawler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import re
import boto3
import botocore
from intakebuilder import getinfo
#from intakebuilder import getinfo
from . import getinfo

'''
s3 crawler crawls through the S3 bucket, passes the bucket path to the helper functions to getinfo.
Expand Down
3 changes: 3 additions & 0 deletions catalogbuilder/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
testpaths =
catalogbuilder/tests
3 changes: 2 additions & 1 deletion catalogbuilder/scripts/gen_intake_gfdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
logger.setLevel(logging.INFO)

try:
from intakebuilder import gfdlcrawler, CSVwriter, builderconfig, configparser
#from intakebuilder import gfdlcrawler, CSVwriter, builderconfig, configparser
from catalogbuilder.intakebuilder import gfdlcrawler, CSVwriter, builderconfig, configparser
except ModuleNotFoundError:
print("The module intakebuilder is not installed. Do you have intakebuilder in your sys.path or have you activated the conda environment with the intakebuilder package in it? ")
print("Attempting again with adjusted sys.path ")
Expand Down
3 changes: 2 additions & 1 deletion catalogbuilder/scripts/gen_intake_gfdl_runner.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env python

#TODO test after conda pkg is published and make changes as needed
from catalogbuilder.scripts import gen_intake_gfdl
#from catalogbuilder.scripts import gen_intake_gfdl
from . import gen_intake_gfdl
import sys

input_path = "/archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp/"
Expand Down
4 changes: 3 additions & 1 deletion catalogbuilder/scripts/gen_intake_gfdl_runner_config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env python

from catalogbuilder.scripts import gen_intake_gfdl
#from catalogbuilder.scripts import gen_intake_gfdl
from . import gen_intake_gfdl
import sys

# this will break at some point #TODO
sys.argv = ['input_path','--config', '/home/a1r/github/CatalogBuilder/scripts/configs/config-example.yml']
print(sys.argv)
gen_intake_gfdl.main()
Expand Down
5 changes: 3 additions & 2 deletions catalogbuilder/scripts/gen_intake_local.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python

import os
from intakebuilder import localcrawler, CSVwriter
#from intakebuilder import localcrawler, CSVwriter
from . import localcrawler, CSVwriter
import logging
logger = logging.getLogger('local')
hdlr = logging.FileHandler('/nbhome/a1r/logs/local.log')
hdlr = logging.FileHandler('/nbhome/a1r/logs/local.log') #TODO this will break
logger.addHandler(hdlr)
logger.setLevel(logging.INFO)

Expand Down
Loading
Loading