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

Update DevOps tooling #551

Merged
merged 1 commit into from
Feb 28, 2022
Merged

Update DevOps tooling #551

merged 1 commit into from
Feb 28, 2022

Conversation

tomvothecoder
Copy link
Collaborator

@tomvothecoder tomvothecoder commented Jan 12, 2022

This PR updates the DevOps tooling to optimize build time, remove deprecated files, and update dependencies to the latest versions.

Summary of Changes

Conda environments:

  • Rename conda/ dir to conda-env/
  • Rename e3sm_diags_env_dev.yml to dev.yml and e3sm_diags_env.yml to prod.yml
    • Update dependencies to the latest versions
    • Update name and prefix of envs from e3sm_diags_env_dev and e3sm_diags_env_prod to e3sm_diags_dev and e3sm_diags_prod
    • Remove dev dependencies in prod.yml (installing latest stable version already includes these dependencies)
  • Add ci.yml for a minimal CI/CD conda env to speed up GH Actions
    • Only contains the minimum dependencies required to build the package and run the test suite
  • Add docs.yml for a minimal CI/CD docs env to speed up GH Actions
    • Only contains the minimum dependencies required to build the documentation

Conda recipe:

  • Remove unused meta.yaml
    • Packages are now released through conda-forge feedstock.

setup.py:

  • Update setup() contents with supported Python versions

setup.cfg and pre-commit-config.yaml:

  • Update dependencies to the latest versions

CI/CD:

  • Add matrix testing for Python 3.8 and 3.9 in build_workflow.yml
  • Replace pip with conda env (docs.yml) in publish-docs step

What to do after this is merged

  1. Pull the latest master
  2. Make sure you are in the root of the repo
  3. Recreate environments using yml
    • dev environment - conda env create -f conda-env/dev.yml
    • prod environment - conda env create -f conda-env/prod.yml
  4. e3sm_diags_dev and e3sm_diags_prod envs are created

@tomvothecoder tomvothecoder added the DevOps CI/CD, configuration, etc. label Jan 12, 2022
@tomvothecoder tomvothecoder self-assigned this Jan 12, 2022
@tomvothecoder tomvothecoder changed the title Devops/550 ci matrix Update DevOps tooling Jan 12, 2022
@tomvothecoder tomvothecoder force-pushed the devops/550-ci-matrix branch 3 times, most recently from 85c6100 to e98273d Compare January 13, 2022 17:06
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Apparently, the package can be built on Python 3.10 based on CI/CD.

I opted not to update our Anaconda environments to 3.10 just yet though.

@@ -82,7 +82,7 @@ def compare_images(
expected_png = Image.open(path_to_expected_png).convert("RGB")
diff = ImageChops.difference(actual_png, expected_png)

diff_dir = "image_check_failures"
diff_dir = f"{TEST_ROOT_PATH}image_check_failures"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The image_check_failures/ dir was being placed in the root of the repo. .gitignore wasn't ignoring it as a result.

@tomvothecoder
Copy link
Collaborator Author

tomvothecoder commented Jan 13, 2022

Hi @forsyth2, I'm hoping to get this PR merged before our next release. If you have the time, it would be great if you can help me fix the failing tests (https://github.com/E3SM-Project/e3sm_diags/runs/4806697230?check_suite_focus=true) and review the PR afterwards.

The changes in this PR should not affect the test suite, which I verified by running the test suite locally on master which also failed. I realized I ran the test suite on master, but using the latest dev env. I used GH Actions to rerun the test suite on master and it is passing, so updating the dependencies (probably matplotlib) is causing the failing build. https://github.com/E3SM-Project/e3sm_diags/runs/4809786157?check_suite_focus=true

Copy link
Collaborator

@forsyth2 forsyth2 left a comment

Choose a reason for hiding this comment

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

Changes look good to me.

As for the test failures, they appear to because of minor plotting changes (probably from the new package versions). Do you want me to update the expected images (https://e3sm-project.github.io/e3sm_diags/_build/html/master/dev_guide/testing.html)?

For tests/complete_run.py, it looks like there are many expected images to update as well. Also, arm_diags/armdiags-convection-onset-twpc3.png isn't being created for some reason.

docs/source/install.rst Outdated Show resolved Hide resolved
@tomvothecoder
Copy link
Collaborator Author

As for the test failures, they appear to because of minor plotting changes (probably from the new package versions). Do you want me to update the expected images (https://e3sm-project.github.io/e3sm_diags/_build/html/master/dev_guide/testing.html)?

Thanks for the link to the instructions. I haven't updated expected images before, but I'll give a shot.

@@ -159,7 +159,7 @@ def precst(precc, precl):

def tauxy(taux, tauy):
"""tauxy = (taux^2 + tauy^2)sqrt"""
var = (taux ** 2 + tauy ** 2) ** 0.5
var = (taux**2 + tauy**2) ** 0.5
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The latest version of black (22.1.0) now fixes unnecessary spaces between **

@tomvothecoder
Copy link
Collaborator Author

tomvothecoder commented Feb 17, 2022

Hi @forsyth2 and @chengzhuzhang, this PR is nearly complete, but the test suite is failing (specifically for enso diags).

I validated that the changes in this PR aren't a factor by running the test suite with the latest stable release (v2.6.1) of e3sm_diags in a production environment. The expected images might have changed since our last release.

Please advise on what I should do here, since I usually don't handle test suite failures related to image diffs. Should I update the expected images?

Related log lines:
https://github.com/E3SM-Project/e3sm_diags/runs/5236139459?check_suite_focus=true#step:7:1211

TestAllSets.results_dir=tests/integration/all_sets_results_test/

path_to_actual_png=tests/integration/all_sets_results_test/area_mean_time_series/TREFHT.png
path_to_expected_png=tests/integration//integration_test_images//area_mean_time_series/TREFHT.png
diff has 8 nonzero pixels.
total number of pixels=3825000
num_nonzero_pixels/num_pixels fraction=2.091503267973856e-06

path_to_actual_png=tests/integration/all_sets_results_test/cosp_histogram/MISR-COSP/MISRCOSP-COSP_HISTOGRAM_MISR-ANN-global.png
path_to_expected_png=tests/integration//integration_test_images//cosp_histogram/MISR-COSP/MISRCOSP-COSP_HISTOGRAM_MISR-ANN-global.png
diff has 74 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=3.5175282234105764e-05

path_to_actual_png=tests/integration/all_sets_results_test/enso_diags/TREFHT-response-map/regression-coefficient-trefht-over-nino34.png
path_to_expected_png=tests/integration//integration_test_images//enso_diags/TREFHT-response-map/regression-coefficient-trefht-over-nino34.png
diff has 76581 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=0.036402139037433154

path_to_actual_png=tests/integration/all_sets_results_test/enso_diags/TREFHT-response-map-start-yrs/regression-coefficient-trefht-over-nino34.png
path_to_expected_png=tests/integration//integration_test_images//enso_diags/TREFHT-response-map-start-yrs/regression-coefficient-trefht-over-nino34.png
diff has 76581 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=0.036402139037433154

path_to_actual_png=tests/integration/all_sets_results_test/enso_diags/TREFHT-response-map-test-ref-yrs/regression-coefficient-trefht-over-nino34.png
path_to_expected_png=tests/integration//integration_test_images//enso_diags/TREFHT-response-map-test-ref-yrs/regression-coefficient-trefht-over-nino34.png
diff has 76581 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=0.036402139037433154

path_to_actual_png=tests/integration/all_sets_results_test/enso_diags/TREFHT-response-scatter/feedback-TREFHT-NINO3-TS-NINO3.png
path_to_expected_png=tests/integration//integration_test_images//enso_diags/TREFHT-response-scatter/feedback-TREFHT-NINO3-TS-NINO3.png
diff has 28769 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=0.013675103980986335

path_to_actual_png=tests/integration/all_sets_results_test/enso_diags/TREFHT-response-scatter-start-yrs/feedback-TREFHT-NINO3-TS-NINO3.png
path_to_expected_png=tests/integration//integration_test_images//enso_diags/TREFHT-response-scatter-start-yrs/feedback-TREFHT-NINO3-TS-NINO3.png
diff has 28769 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=0.013675103980986335

path_to_actual_png=tests/integration/all_sets_results_test/enso_diags/TREFHT-response-scatter-test-ref-yrs/feedback-TREFHT-NINO3-TS-NINO3.png
path_to_expected_png=tests/integration//integration_test_images//enso_diags/TREFHT-response-scatter-test-ref-yrs/feedback-TREFHT-NINO3-TS-NINO3.png
diff has 28769 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=0.013675103980986335

path_to_actual_png=tests/integration/all_sets_results_test/lat_lon/ERA-Interim/ERA-Interim-T-850-ANN-global.png
path_to_expected_png=tests/integration//integration_test_images//lat_lon/ERA-Interim/ERA-Interim-T-850-ANN-global.png
diff has 86 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=4.0879382055852646e-05

path_to_actual_png=tests/integration/all_sets_results_test/lat_lon/ERA-Interim/ERA-Interim-T-850-ANN-CONUS_RRM.png
path_to_expected_png=tests/integration//integration_test_images//lat_lon/ERA-Interim/ERA-Interim-T-850-ANN-CONUS_RRM.png
diff has 170 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=8.080808080808081e-05

path_to_actual_png=tests/integration/all_sets_results_test/meridional_mean_2d/ERA-Interim/ERA-Interim-T-ANN-global.png
path_to_expected_png=tests/integration//integration_test_images//meridional_mean_2d/ERA-Interim/ERA-Interim-T-ANN-global.png
diff has 74 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=3.5175282234105764e-05

path_to_actual_png=tests/integration/all_sets_results_test/polar/ERA-Interim/ERA-Interim-T-850-ANN-polar_S.png
path_to_expected_png=tests/integration//integration_test_images//polar/ERA-Interim/ERA-Interim-T-850-ANN-polar_S.png
diff has 532 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=0.0002528817587641117
tests/integration/all_sets_results_test/qbo/qbo-test/qbo_diags.png

path_to_actual_png=tests/integration/all_sets_results_test/qbo/qbo-test/qbo_diags.png
path_to_expected_png=tests/integration//integration_test_images//qbo/qbo-test/qbo_diags.png
diff has 30 nonzero pixels.
total number of pixels=1960000
num_nonzero_pixels/num_pixels fraction=1.530612244897959e-05

path_to_actual_png=tests/integration/all_sets_results_test/streamflow/RIVER_DISCHARGE_OVER_LAND_LIQ_GSIM/seasonality_map.png
path_to_expected_png=tests/integration//integration_test_images//streamflow/RIVER_DISCHARGE_OVER_LAND_LIQ_GSIM/seasonality_map.png
diff has 6 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=2.8520499108734404e-06

path_to_actual_png=tests/integration/all_sets_results_test/streamflow/RIVER_DISCHARGE_OVER_LAND_LIQ_GSIM/annual_map.png
path_to_expected_png=tests/integration//integration_test_images//streamflow/RIVER_DISCHARGE_OVER_LAND_LIQ_GSIM/annual_map.png
diff has 58 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=2.756981580510992e-05

path_to_actual_png=tests/integration/all_sets_results_test/zonal_mean_2d/ERA-Interim/ERA-Interim-T-ANN-global.png
..FFFFFF....F.....
======================================================================
FAIL: test_enso_diags_map (tests.integration.test_diags.TestAllSets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 372, in test_enso_diags_map
    self.check_enso_map_plots(case_id)
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 278, in check_enso_map_plots
    self.check_html_image(html_path, png_path, full_png_path)
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 199, in check_html_image
    self.assertEqual(mismatched_images, [])
AssertionError: Lists differ: ['regression-coefficient-trefht-over-nino34.png'] != []

First list contains 1 additional elements.
First extra element 0:
'regression-coefficient-trefht-over-nino34.png'

- ['regression-coefficient-trefht-over-nino34.png']
+ []

======================================================================
FAIL: test_enso_diags_map_start_yrs (tests.integration.test_diags.TestAllSets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 376, in test_enso_diags_map_start_yrs
    self.check_enso_map_plots(case_id)
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 278, in check_enso_map_plots
    self.check_html_image(html_path, png_path, full_png_path)
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 199, in check_html_image
    self.assertEqual(mismatched_images, [])
AssertionError: Lists differ: ['regression-coefficient-trefht-over-nino34.png'] != []

First list contains 1 additional elements.
First extra element 0:
'regression-coefficient-trefht-over-nino34.png'

- ['regression-coefficient-trefht-over-nino34.png']
+ []

======================================================================
FAIL: test_enso_diags_map_test_ref_yrs (tests.integration.test_diags.TestAllSets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 380, in test_enso_diags_map_test_ref_yrs
    self.check_enso_map_plots(case_id)
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 278, in check_enso_map_plots
    self.check_html_image(html_path, png_path, full_png_path)
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 199, in check_html_image
    self.assertEqual(mismatched_images, [])
AssertionError: Lists differ: ['regression-coefficient-trefht-over-nino34.png'] != []

First list contains 1 additional elements.
First extra element 0:
'regression-coefficient-trefht-over-nino34.png'

- ['regression-coefficient-trefht-over-nino34.png']
+ []

======================================================================
FAIL: test_enso_diags_scatter (tests.integration.test_diags.TestAllSets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 384, in test_enso_diags_scatter
    self.check_enso_scatter_plots(case_id)
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 294, in check_enso_scatter_plots
    self.check_html_image(html_path, png_path, full_png_path)
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 199, in check_html_image
    self.assertEqual(mismatched_images, [])
AssertionError: Lists differ: ['feedback-TREFHT-NINO3-TS-NINO3.png'] != []

First list contains 1 additional elements.
First extra element 0:
'feedback-TREFHT-NINO3-TS-NINO3.png'

- ['feedback-TREFHT-NINO3-TS-NINO3.png']
+ []

======================================================================
FAIL: test_enso_diags_scatter_start_yrs (tests.integration.test_diags.TestAllSets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 388, in test_enso_diags_scatter_start_yrs
    self.check_enso_scatter_plots(case_id)
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 294, in check_enso_scatter_plots
    self.check_html_image(html_path, png_path, full_png_path)
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 199, in check_html_image
    self.assertEqual(mismatched_images, [])
AssertionError: Lists differ: ['feedback-TREFHT-NINO3-TS-NINO3.png'] != []

First list contains 1 additional elements.
First extra element 0:
'feedback-TREFHT-NINO3-TS-NINO3.png'

- ['feedback-TREFHT-NINO3-TS-NINO3.png']
+ []

======================================================================
FAIL: test_enso_diags_scatter_test_ref_yrs (tests.integration.test_diags.TestAllSets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 392, in test_enso_diags_scatter_test_ref_yrs
    self.check_enso_scatter_plots(case_id)
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 294, in check_enso_scatter_plots
    self.check_html_image(html_path, png_path, full_png_path)
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 199, in check_html_image
    self.assertEqual(mismatched_images, [])
AssertionError: Lists differ: ['feedback-TREFHT-NINO3-TS-NINO3.png'] != []

First list contains 1 additional elements.
First extra element 0:
'feedback-TREFHT-NINO3-TS-NINO3.png'

- ['feedback-TREFHT-NINO3-TS-NINO3.png']
+ []

======================================================================
FAIL: test_polar (tests.integration.test_diags.TestAllSets)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 404, in test_polar
    self.check_plots_plevs("polar", "polar_S", [850.0])
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 254, in check_plots_plevs
    self.check_plots_generic(
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 241, in check_plots_generic
    self.check_html_image(html_path, png_path, full_png_path)
  File "/home/runner/work/e3sm_diags/e3sm_diags/tests/integration/test_diags.py", line 199, in check_html_image
    self.assertEqual(mismatched_images, [])
AssertionError: Lists differ: ['ERA-Interim-T-850-ANN-polar_S.png'] != []

First list contains 1 additional elements.
First extra element 0:
'ERA-Interim-T-850-ANN-polar_S.png'

- ['ERA-Interim-T-850-ANN-polar_S.png']
+ []

----------------------------------------------------------------------
Ran 18 tests in 188.050s

FAILED (failures=7)
path_to_expected_png=tests/integration//integration_test_images//zonal_mean_2d/ERA-Interim/ERA-Interim-T-ANN-global.png
diff has 126 nonzero pixels.
total number of pixels=2103750
num_nonzero_pixels/num_pixels fraction=5.9893048128342244e-05

@forsyth2
Copy link
Collaborator

forsyth2 commented Feb 17, 2022

@tomvothecoder

The expected images might have changed since our last release.

That's almost certainly what happened

Please advise on what I should do here, since I usually don't handle test suite failures related to image diffs. Should I update the expected images?

Let me investigate. I'll let you know

@forsyth2
Copy link
Collaborator

@tomvothecoder Well I have tests passing on master, but I can't appear to build the environment being used in this PR to test it:

$ cd /home/ac.forsyth2/e3sm_diags
$ git checkout master
$ git fetch upstream master
$ git rebase upstream/master

# Steps from https://e3sm-project.github.io/e3sm_diags/_build/html/master/install.html:
$ conda clean --all
$ conda env create -f conda/e3sm_diags_env_dev.yml -n diags_dev_v261
$ conda activate diags_dev_v261

$ ./tests/clean_tests_repo.sh

# Follow steps from https://e3sm-project.github.io/e3sm_diags/_build/html/master/dev_guide/testing.html:
$ pip install .
$ ./tests/test.sh
# All tests pass

$ git fetch upstream
$ git checkout -b test-pr-551 upstream/devops/550-ci-matrix
$ conda deactivate

# Steps from https://e3sm-project.github.io/e3sm_diags/_build/html/master/install.html:
$ conda clean --all
$ conda env create -f conda-env/dev.yml -n diags_dev_pr551
$ conda activate diags_dev_pr551
Collecting package metadata (repodata.json): done
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                     /                                                                    |
Solving environment: /
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                     |          /                                                         \

UnsatisfiableError: The following specifications were found to be incompatible with each other:
[...]
The following specifications were found to be incompatible with your system:

  - feature:/linux-64::__glibc==2.28=0
  - feature:|@/linux-64::__glibc==2.28=0
  - cdms2=3.1.5 -> libgfortran-ng -> __glibc[version='>=2.17']
  - cdtime=3.1.4 -> libgfortran-ng -> __glibc[version='>=2.17']
  - genutil=8.2.1 -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
  - lxml=4.7.1 -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
  - netcdf4=1.5.8 -> openssh -> __glibc[version='>=2.17,<3.0.a0']
  - scipy=1.8.0 -> libgfortran-ng -> __glibc[version='>=2.17']

Your installed version is: 2.28

Note that strict channel priority may have removed packages required for satisfiability.

@tomvothecoder
Copy link
Collaborator Author

tomvothecoder commented Feb 18, 2022

@forsyth2 Thanks a lot for checking it out.

$ cd /home/ac.forsyth2/e3sm_diags
$ git checkout master
$ git fetch upstream master
$ git rebase upstream/master

# Steps from https://e3sm-project.github.io/e3sm_diags/_build/html/master/install.html:
$ conda clean --all
$ conda env create -f conda/e3sm_diags_env_dev.yml -n diags_dev_v261
$ conda activate diags_dev_v261

$ ./tests/clean_tests_repo.sh

# Follow steps from https://e3sm-project.github.io/e3sm_diags/_build/html/master/dev_guide/testing.html:
$ pip install .
$ ./tests/test.sh
# All tests pass

I followed these steps and the tests pass also on my end. e3sm_diags_env_dev.yml pins old versions of the dependencies (matplotlib=3.4.2), while dev.yml pins the latest versions (matplotlib=3.5.1). This might explain why the PR build is failing, which relates to Xylar's comment about the fragility of matplotlib versions and the image diff checker.

e3sm_diags_env_dev.yml (old): https://github.com/E3SM-Project/e3sm_diags/pull/551/files#diff-36e26edc30e799db6a26970144e04a0b371293752543788811c481133437f220

dev.yml (new): https://github.com/E3SM-Project/e3sm_diags/pull/551/files#diff-8349720d2c3c13b89033622dc7617e89cdc970177deed2f40c2dc84c52562224

$ git fetch upstream
$ git checkout -b test-pr-551 upstream/devops/550-ci-matrix
$ conda deactivate

# Steps from https://e3sm-project.github.io/e3sm_diags/_build/html/master/install.html:
$ conda clean --all
$ conda env create -f conda-env/dev.yml -n diags_dev_pr551
$ conda activate diags_dev_pr551
Collecting package metadata (repodata.json): done
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                     /                                                                    |
Solving environment: /
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                     |          /                                                         \

UnsatisfiableError: The following specifications were found to be incompatible with each other:
[...]
The following specifications were found to be incompatible with your system:

  - feature:/linux-64::__glibc==2.28=0
  - feature:|@/linux-64::__glibc==2.28=0
  - cdms2=3.1.5 -> libgfortran-ng -> __glibc[version='>=2.17']
  - cdtime=3.1.4 -> libgfortran-ng -> __glibc[version='>=2.17']
  - genutil=8.2.1 -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
  - lxml=4.7.1 -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
  - netcdf4=1.5.8 -> openssh -> __glibc[version='>=2.17,<3.0.a0']
  - scipy=1.8.0 -> libgfortran-ng -> __glibc[version='>=2.17']

Your installed version is: 2.28

Note that strict channel priority may have removed packages required for satisfiability.

I would create a clean environment using dev.yml because it introduces many dependency updates, instead of trying to update the old environment from e3sm_diags_env_dev.yml.

Note, the env is now called e3sm_diags_dev in dev.yml so you don't need to specify a new name with -n.

@forsyth2
Copy link
Collaborator

I would create a clean environment using dev.yml

I thought that's what I was doing with conda env create -f conda-env/dev.yml -n diags_dev_pr551. Is that incorrect?

@tomvothecoder
Copy link
Collaborator Author

tomvothecoder commented Feb 18, 2022

I would create a clean environment using dev.yml

I thought that's what I was doing with conda env create -f conda-env/dev.yml -n diags_dev_pr551. Is that incorrect?

Ahh I misread your command and thought diags_dev_pr551 was e3sm_diags_env_dev.

It's very odd that conda env create -f conda-env/dev.yml -n diags_dev_pr551 fails with package conflicts, but mamba env create -f conda-env/dev.yml -n diags_dev_pr551 works perfectly fine. I prefer mamba (which is installed in the base conda env) now because it is significantly quicker to create environments and has much clearer tracebacks.

I will debug this and keep you posted.

@xylar
Copy link
Contributor

xylar commented Feb 18, 2022

I have a tool I use when mamba fails to solve packages:
https://gist.github.com/xylar/e02438b5a19e8aa73439ef2bc42b9aea
Replace the list of packages with yours and it will find the first package in the list that causes the solve to fail. You can re-order the list by putting the failing package at the top to see what other package it conflicts with.

You could modify the tool to use conda instead of mamba if you don't mind it taking all day...

@tomvothecoder
Copy link
Collaborator Author

Thanks for providing that tool @xylar, it looks really useful.

In my case, I took an alternate approach by building the production env with the latest stable version of e3sm_diags. I checked if the base dependencies of the prod env aligned with the base dependencies of the dev env, which they did. Through process of elimination, I found the dev env package conflict was related to sphinx=4.4.0 and some other package(s). I pinned sphinx=4.3.2 instead and now the dev env builds properly.

I still need to figure out the root cause of the conflict, but at least things are working again for now.

@forsyth2, you can try building the dev env using dev.yml and running the test now.

@forsyth2
Copy link
Collaborator

you can try building the dev env using dev.yml and running the test now.

@tomvothecoder Ok, I got 7 test failures that appear to be caused by the 3 image failures at https://web.lcrc.anl.gov/public/e3sm/diagnostic_output/ac.forsyth2/e3sm_diags_development/image_check_failures_20220224/. The only noteworthy diff I see is that feedback-TREFHT-NINO3-TS-NINO3 changes the ordering of its legend.

So, I think it's ok to just update the expected images as described in https://e3sm-project.github.io/e3sm_diags/_build/html/master/dev_guide/testing.html. Do you want me to do that?

@tomvothecoder
Copy link
Collaborator Author

Thanks for checking @forsyth2! That would be awesome if you can handle updating the expected images since I'll be out tomorrow.

@forsyth2
Copy link
Collaborator

forsyth2 commented Feb 26, 2022

@tomvothecoder Ok the build workflows are passing now. For reference, here are the steps I ran:

$ cd /home/ac.forsyth2/e3sm_diags
$ conda activate diags_dev_pr551_20220224
$ pip install .
$ ./tests/clean_tests_repo.sh
$ ./tests/test.sh

# Follow steps from https://e3sm-project.github.io/e3sm_diags/_build/html/master/dev_guide/testing.html
$ cd /lcrc/group/e3sm/public_html/e3sm_diags_test_data/integration/expected
$ cat README.md
E3SM Diags version: v2_5_0
Date these files were generated: 20210706
Hash of commit (first 7 characters): 69b01d2
$ mv integration_test_images previous_output/integration_test_images_v2_5_0_20210706_69b01d2
$ cd /home/ac.forsyth2/e3sm_diags
# TODO: Directions need to be updated
$ mv tests/integration/all_sets_results_test /lcrc/group/e3sm/public_html/e3sm_diags_test_data/integration/expected/integration_test_images
$ cd /lcrc/group/e3sm/public_html/e3sm_diags_test_data/integration/expected

$ ls
integration_test_images  previous_output  README.md  README.md~
$ cd /home/ac.forsyth2/e3sm_diags
$ ./tests/clean_tests_repo.sh
$ ./tests/test.sh
# All tests pass

# TODO: After merging this pull request
# Edit README.md:
E3SM Diags version: v2_6_1
Date these files were generated: 2022_02_25
Hash of commit (first 7 characters): <hash after merging PR>

To do:

@tomvothecoder
Copy link
Collaborator Author

@forsyth2 Great, thanks for taking care of that Ryan. Happy to see the build is passing again!

Anaconda:
- Remove unused `meta.yaml` (packages are now released through conda-forge feedstock)
  - Remove `meta.yaml` from `tbump.toml`
- Rename `conda/` dir to `conda-env/`
- Rename `e3sm_diags_env_dev.yml` to `dev.yml` and `e3sm_diags_env.yml` to `prod.yml`
  - Update dependencies to the latest versions
  - Update name and prefix of envs
  - Remove dev dependences in `prod.yml`
- Add `ci.yml` for a minimal CI/CD conda env to speed up GH Actions
  - Only contains the minimum dependencies required to build the package and run the test suite
- Add `docs.yml` for minimal CI/CD docs env to speed up GH Actions
  - Only contains the minimum dependencies required to build the documentation

CI/CD:
- Add Python matrix testing to `build_workflow.yml`
- Use `ci.yml` instead of `dev.yml` when building conda env

`setup.py`:
- Update `setup()` contents with supported Python versions

`setup.cfg` and `pre-commit-config.yaml`
- Update dependencies to the latest versions

Docs:
- Update `docs/source/install.rst` with latest conda env updates
@tomvothecoder tomvothecoder merged commit 8ec9a41 into master Feb 28, 2022
@tomvothecoder tomvothecoder deleted the devops/550-ci-matrix branch February 28, 2022 16:51
@tomvothecoder
Copy link
Collaborator Author

FYI @forsyth2 and @chengzhuzhang, you should follow the "What to do after this is merged" instructions in this PR.

@chengzhuzhang
Copy link
Contributor

Thank you for the heads-up!

@forsyth2
Copy link
Collaborator

@tomvothecoder Thanks, I updated my environments and also did the update-README step I listed above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DevOps CI/CD, configuration, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update DevOps tooling
4 participants