From eafa22ab20c0511026041488f5269e6165900289 Mon Sep 17 00:00:00 2001 From: "Pey Lian Lim (Github)" <2090236+pllim@users.noreply.github.com> Date: Thu, 8 Dec 2022 18:42:34 -0500 Subject: [PATCH 1/4] TST: Add RC testing workflow and update existing --- .github/workflows/ci_cron_weekly.yml | 3 ++ .github/workflows/ci_workflows.yml | 3 ++ .github/workflows/codeql-analysis.yml | 3 ++ .github/workflows/predeps_workflows.yml | 53 +++++++++++++++++++++++++ tox.ini | 6 ++- 5 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/predeps_workflows.yml diff --git a/.github/workflows/ci_cron_weekly.yml b/.github/workflows/ci_cron_weekly.yml index 8d18d00a08..7817f9405a 100644 --- a/.github/workflows/ci_cron_weekly.yml +++ b/.github/workflows/ci_cron_weekly.yml @@ -7,6 +7,9 @@ on: # run at 9am UTC on Mondays - cron: '0 9 * * 1' +permissions: + contents: read + jobs: # The linkcheck job tests that the links in the docs point to real places # The if statement is to prevent cron from running on forks. diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index a86fff507a..427ec1c28c 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -13,6 +13,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: + contents: read + jobs: # Github Actions supports ubuntu, windows, and macos virtual environments: # https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4c46da726b..688f69dbff 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -10,6 +10,9 @@ on: # run every Monday at 3am UTC - cron: '0 3 * * 1' +permissions: + contents: read + jobs: analyze: name: Analyze diff --git a/.github/workflows/predeps_workflows.yml b/.github/workflows/predeps_workflows.yml new file mode 100644 index 0000000000..13bf18250c --- /dev/null +++ b/.github/workflows/predeps_workflows.yml @@ -0,0 +1,53 @@ +name: rc-testing + +on: + workflow_dispatch: + # REMOVE ME + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + # Github Actions supports ubuntu, windows, and macos virtual environments: + # https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners + ci_tests: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + + - name: RC testing on Linux with remote data + os: ubuntu-latest + python: '3.11' + toxenv: py311-test-predeps + toxposargs: --remote-data + + - name: RC testing on OSX + os: macos-latest + python: 3.9 + toxenv: py39-test-predeps + + - name: RC testing on Windows + os: windows-latest + python: '3.10' + toxenv: py310-test-predeps + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up python ${{ matrix.python }} on ${{ matrix.os }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - name: Install base dependencies + run: python -m pip install --upgrade pip tox + - name: Test/run with tox + run: tox -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }} diff --git a/tox.ini b/tox.ini index 58985ec44a..981f080cdf 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{38,39,310,311}-test{,-alldeps,-devdeps}{,-cov} + py{38,39,310,311}-test{,-alldeps,-devdeps,-predeps}{,-cov} linkcheck codestyle pep517 @@ -71,6 +71,10 @@ commands = cov: pytest --pyargs jdaviz {toxinidir}/docs --cov jdaviz --cov-config={toxinidir}/setup.cfg {posargs} cov: coverage xml -o {toxinidir}/coverage.xml +pip_pre = + predeps: true + !predeps: false + [testenv:linkcheck] changedir = docs description = check the links in the HTML docs From 7985bf8f031403c810740b7348e3d9c58f73371f Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Tue, 31 Jan 2023 09:16:12 -0500 Subject: [PATCH 2/4] Catalogs: SDSS now has max radius of 3 arcmin in the pre-release of astroquery 0.4.7.dev. Also make Catalog to not crash horribly when query fails. Update catalogs test results. --- .../imviz/plugins/catalogs/catalogs.py | 20 +++++++++++++++++-- jdaviz/configs/imviz/tests/test_catalogs.py | 6 +++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/jdaviz/configs/imviz/plugins/catalogs/catalogs.py b/jdaviz/configs/imviz/plugins/catalogs/catalogs.py index 68fd131f67..c1f72431d8 100644 --- a/jdaviz/configs/imviz/plugins/catalogs/catalogs.py +++ b/jdaviz/configs/imviz/plugins/catalogs/catalogs.py @@ -2,11 +2,13 @@ import numpy as np import numpy.ma as ma +from astropy import units as u from astropy.table import QTable from astropy.coordinates import SkyCoord from traitlets import List, Unicode, Bool, Int, observe from jdaviz.configs.default.plugins.data_tools.file_chooser import FileChooser +from jdaviz.core.events import SnackbarMessage from jdaviz.core.registries import tray_registry from jdaviz.core.template_mixin import (PluginTemplateMixin, ViewerSelectMixin, SelectPluginComponent) @@ -127,11 +129,25 @@ def search(self): # conducts search based on SDSS if self.catalog_selected == "SDSS": from astroquery.sdss import SDSS + r_max = 3 * u.arcmin # queries the region (based on the provided center point and radius) # finds all the sources in that region - query_region_result = SDSS.query_region(skycoord_center, radius=zoom_radius, - data_release=17) + try: + if zoom_radius > r_max: # SDSS now has radius max limit + self.hub.broadcast(SnackbarMessage( + f"Radius for {self.catalog_selected} has max radius of {r_max} but got " + f"{zoom_radius.to(u.arcmin)}, using {r_max}.", + color='warning', sender=self)) + zoom_radius = r_max + query_region_result = SDSS.query_region(skycoord_center, radius=zoom_radius, + data_release=17) + except Exception as e: # nosec + self.hub.broadcast(SnackbarMessage( + f"Failed to query {self.catalog_selected} with c={skycoord_center} and " + f"r={zoom_radius}: {repr(e)}", color='error', sender=self)) + query_region_result = None + if query_region_result is None: self.results_available = True self.number_of_results = 0 diff --git a/jdaviz/configs/imviz/tests/test_catalogs.py b/jdaviz/configs/imviz/tests/test_catalogs.py index 61b2bdcb00..565edf6717 100644 --- a/jdaviz/configs/imviz/tests/test_catalogs.py +++ b/jdaviz/configs/imviz/tests/test_catalogs.py @@ -93,9 +93,9 @@ def test_plugin_image_with_result(self, imviz_helper, tmp_path): catalogs_plugin.vue_do_search() # number of results should be > 0 - # '2473' was determined by running the search with the image in the notebook + # Answer was determined by running the search with the image in the notebook. assert catalogs_plugin.results_available - assert catalogs_plugin.number_of_results == 2473 + assert catalogs_plugin.number_of_results == 668 # testing that every variable updates accordingly when markers are cleared catalogs_plugin.vue_do_clear() @@ -116,7 +116,7 @@ def test_plugin_image_with_result(self, imviz_helper, tmp_path): assert catalogs_plugin.catalog.selected == 'From File...' catalogs_plugin.vue_do_search() assert catalogs_plugin.results_available - assert catalogs_plugin.number_of_results == 2473 + assert catalogs_plugin.number_of_results == 668 def test_from_file_parsing(imviz_helper, tmp_path): From 4857100a1e46719c0b3611e3d3d0b6ce781abab1 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Tue, 7 Feb 2023 11:59:18 -0500 Subject: [PATCH 3/4] Relax astroquery test answer because upstream number of matches can change but that is not our problem. --- jdaviz/configs/imviz/tests/test_catalogs.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jdaviz/configs/imviz/tests/test_catalogs.py b/jdaviz/configs/imviz/tests/test_catalogs.py index 565edf6717..a265f5b093 100644 --- a/jdaviz/configs/imviz/tests/test_catalogs.py +++ b/jdaviz/configs/imviz/tests/test_catalogs.py @@ -92,10 +92,11 @@ def test_plugin_image_with_result(self, imviz_helper, tmp_path): catalogs_plugin.plugin_opened = True catalogs_plugin.vue_do_search() - # number of results should be > 0 + # number of results should be > 500 or so # Answer was determined by running the search with the image in the notebook. assert catalogs_plugin.results_available - assert catalogs_plugin.number_of_results == 668 + assert catalogs_plugin.number_of_results > 500 + prev_results = catalogs_plugin.number_of_results # testing that every variable updates accordingly when markers are cleared catalogs_plugin.vue_do_clear() @@ -116,7 +117,7 @@ def test_plugin_image_with_result(self, imviz_helper, tmp_path): assert catalogs_plugin.catalog.selected == 'From File...' catalogs_plugin.vue_do_search() assert catalogs_plugin.results_available - assert catalogs_plugin.number_of_results == 668 + assert catalogs_plugin.number_of_results == prev_results def test_from_file_parsing(imviz_helper, tmp_path): From 82da9df76acb483f32800bebc301fde355c17a39 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Tue, 7 Feb 2023 12:40:54 -0500 Subject: [PATCH 4/4] Run RC as cron too but on Tuesdays --- .github/workflows/predeps_workflows.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/predeps_workflows.yml b/.github/workflows/predeps_workflows.yml index 13bf18250c..1dfafd9b48 100644 --- a/.github/workflows/predeps_workflows.yml +++ b/.github/workflows/predeps_workflows.yml @@ -2,8 +2,9 @@ name: rc-testing on: workflow_dispatch: - # REMOVE ME - pull_request: + schedule: + # run at 9am UTC on Tuesdays + - cron: '0 9 * * 2' concurrency: group: ${{ github.workflow }}-${{ github.ref }}