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

Streamline CI test runtimes #459

Merged
merged 2 commits into from
May 13, 2021
Merged

Conversation

mperrin
Copy link
Collaborator

@mperrin mperrin commented May 13, 2021

Let's try to make the test suite not take 15+ minutes to run, without compromising coverage substantially. Are the tests we're running efficient?

Method. Use pytest --durations=0 to print out a list of the time consuming tests, then see if we can find efficiencies.

  • use fewer wavelengths in psf_grid test to reduce test runtime, at no significant loss in test coverage.
  • Same for in test_opds for testing the 1024 vs 2048 npix, which does not require more than 1 wavelength.

Outputs from pytest durations prior to these changes:

34.62s call     webbpsf/tests/test_psfgrid.py::test_wfi
26.75s call     webbpsf/tests/test_psfgrid.py::test_compare_to_calc_psf_detsampled
19.87s call     webbpsf/tests/test_psfgrid.py::test_saving
19.41s call     webbpsf/tests/test_roman.py::test_WFI_filters
16.83s call     webbpsf/tests/test_psfgrid.py::test_compare_to_calc_psf_oversampled
15.17s call     webbpsf/tests/test_fgs.py::test_fgs
14.31s call     webbpsf/tests/test_nircam.py::test_nircam_blc_wedge_45
14.07s call     webbpsf/tests/test_nircam.py::test_nircam_blc_wedge_0
13.60s call     webbpsf/tests/test_psfgrid.py::test_all_detectors
13.25s call     webbpsf/tests/test_nircam.py::test_nircam_blc_circ_45
12.79s call     webbpsf/tests/test_roman.py::test_WFI_fwhm
12.59s call     webbpsf/tests/test_nircam.py::test_nircam_blc_circ_0
12.09s call     webbpsf/tests/test_miri.py::test_miri
10.95s call     webbpsf/tests/test_nirspec.py::test_nirspec
10.86s call     webbpsf/tests/test_distortion.py::test_apply_distortion_skew
10.19s call     webbpsf/tests/test_nircam.py::test_nircam

@codecov
Copy link

codecov bot commented May 13, 2021

Codecov Report

Merging #459 (2b08888) into develop (fa0136b) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #459   +/-   ##
========================================
  Coverage    64.06%   64.06%           
========================================
  Files           11       11           
  Lines         4352     4352           
========================================
  Hits          2788     2788           
  Misses        1564     1564           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa0136b...2b08888. Read the comment docs.

@mperrin
Copy link
Collaborator Author

mperrin commented May 13, 2021

After these changes (and after merging in PR #440

25.26s call     webbpsf/tests/test_opds.py::test_changing_npix
18.52s call     webbpsf/tests/test_psfgrid.py::test_saving
17.07s call     webbpsf/tests/test_roman.py::test_WFI_filters
15.57s call     webbpsf/tests/test_fgs.py::test_fgs
15.14s call     webbpsf/tests/test_psfgrid.py::test_compare_to_calc_psf_oversampled
14.97s call     webbpsf/tests/test_nircam.py::test_nircam_blc_wedge_45
14.80s call     webbpsf/tests/test_nircam.py::test_nircam_blc_wedge_0
13.48s call     webbpsf/tests/test_nircam.py::test_nircam_blc_circ_45
13.16s call     webbpsf/tests/test_nircam.py::test_nircam_blc_circ_0
13.01s call     webbpsf/tests/test_roman.py::test_WFI_fwhm
12.86s call     webbpsf/tests/test_psfgrid.py::test_all_detectors
12.44s call     webbpsf/tests/test_miri.py::test_miri
12.10s call     webbpsf/tests/test_psfgrid.py::test_wfi
11.77s call     webbpsf/tests/test_nirspec.py::test_nirspec
11.19s call     webbpsf/tests/test_distortion.py::test_apply_distortion_skew
10.30s call     webbpsf/tests/test_nircam.py::test_nircam

@mperrin mperrin requested a review from shanosborne May 13, 2021 14:49
@mperrin
Copy link
Collaborator Author

mperrin commented May 13, 2021

I think this has succeeded in shaving off a couple minutes.

It's not apples to oranges to compare the timing from my local machine vs. the VMs that the CI runs in. But locally these changes have trimmed total test suite runtime from ~500 to ~400 s. (with substantial variation run to run depending on other local loads, I think).

After these changes:

16.21s call     webbpsf/tests/test_opds.py::test_changing_npix
14.54s call     webbpsf/tests/test_roman.py::test_WFI_filters
13.72s call     webbpsf/tests/test_fgs.py::test_fgs
13.50s call     webbpsf/tests/test_psfgrid.py::test_compare_to_calc_psf_oversampled
13.39s call     webbpsf/tests/test_nircam.py::test_nircam_blc_wedge_45
12.69s call     webbpsf/tests/test_nircam.py::test_nircam_blc_wedge_0
12.58s call     webbpsf/tests/test_nircam.py::test_nircam_blc_circ_45
12.18s call     webbpsf/tests/test_psfgrid.py::test_saving
11.87s call     webbpsf/tests/test_psfgrid.py::test_all_detectors
11.65s call     webbpsf/tests/test_nircam.py::test_nircam_blc_circ_0
11.40s call     webbpsf/tests/test_nirspec.py::test_nirspec
11.23s call     webbpsf/tests/test_miri.py::test_miri
11.06s call     webbpsf/tests/test_roman.py::test_WFI_fwhm

@mperrin mperrin merged commit e88712d into spacetelescope:develop May 13, 2021
@mperrin mperrin deleted the streamline_tests branch May 13, 2021 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants