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

BUG: some of the examples are flaky #98

Open
bsipocz opened this issue Dec 6, 2022 · 0 comments
Open

BUG: some of the examples are flaky #98

bsipocz opened this issue Dec 6, 2022 · 0 comments
Labels
bug Something isn't working content Issues regarding the content of the notebooks

Comments

@bsipocz
Copy link
Contributor

bsipocz commented Dec 6, 2022

connection / remote service issues are often run into with CI, we may want to make the examples more roboust (maybe there are timeouts we can extend).

as for the CI, we may address this issue by using pytest-rerunfailures as we do for astroquery and pyvo testing. I suppose it will work out of the box, even for notebooks, but it may not be the case.

I do volunteer to look into the CI/testing part, but it would be nice if one could look into ways to enhance the content. Here is the latest summary and one traceback:

=========================== short test summary info ============================
FAILED QuickReference.ipynb::Cell 9
FAILED UseCase_I.ipynb::Cell 31

=================================== FAILURES ===================================
_________________________ QuickReference.ipynb::Cell 9 _________________________
Notebook cell execution failed
Cell 9: Cell execution caused an exception

Input:
# Search for a spectrum search service that has x-ray data.
services = vo.regsearch(servicetype='spectrum', waveband='x-ray')

# Assuming there are services and the first one is OK...
results = services[0].search(pos=SkyCoord.from_name("Delta Ori"), 
                             diameter=Angle(10 * u.arcmin))

# Assuming there are results, download the first file.
print(f'Title: {results[0].title}, Format: {results[0].format}')
file_name = download_file(results[0].getdataurl())  
file_name

Traceback:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File ~/work/navo-workshop/navo-workshop/.tox/py38-test-oldestdeps/lib/python3.8/site-packages/pyvo/dal/query.py:243, in DALQuery.execute_votable(self, post)
    242 try:
--> 243     return votableparse(self.execute_stream(post=post).read)
    244 except Exception as e:

File ~/work/navo-workshop/navo-workshop/.tox/py38-test-oldestdeps/lib/python3.8/site-packages/astropy/utils/decorators.py:547, in deprecated_renamed_argument.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
    545         warnings.warn(msg, warning_type, stacklevel=2)
--> 547 return function(*args, **kwargs)

File ~/work/navo-workshop/navo-workshop/.tox/py38-test-oldestdeps/lib/python3.8/site-packages/astropy/io/votable/table.py:159, in parse(source, columns, invalid, verify, chunk_size, table_number, table_id, filename, unit_format, datatype_mapping, _debug_python_based_parser)
    156 with iterparser.get_xml_iterator(
    157         source,
    158         _debug_python_based_parser=_debug_python_based_parser) as iterator:
--> 159     return tree.VOTableFile(
    160         config=config, pos=(1, 1)).parse(iterator, config)

File ~/work/navo-workshop/navo-workshop/.tox/py38-test-oldestdeps/lib/python3.8/site-packages/astropy/io/votable/tree.py:3573, in VOTableFile.parse(self, iterator, config)
   3571 config['_current_table_number'] = 0
-> 3573 for start, tag, data, pos in iterator:
   3574     if start:

ValueError: 1:0: syntax error

During handling of the above exception, another exception occurred:

DALFormatError                            Traceback (most recent call last)
Cell In [10], line 5
      2 services = vo.regsearch(servicetype='spectrum', waveband='x-ray')
      4 # Assuming there are services and the first one is OK...
----> 5 results = services[0].search(pos=SkyCoord.from_name("Delta Ori"), 
      6                              diameter=Angle(10 * u.arcmin))
      8 # Assuming there are results, download the first file.
      9 print(f'Title: {results[0].title}, Format: {results[0].format}')

File ~/work/navo-workshop/navo-workshop/.tox/py38-test-oldestdeps/lib/python3.8/site-packages/pyvo/registry/regtap.py:709, in RegistryResource.search(self, *args, **keys)
    704 if not self.service:
    705     raise dalq.DALServiceError(
     43     ax.set_title('GALEX image not found')
     45 # SDSS
     46 
     47 # Find the SDSS images that overlap the position.
---> 48 sdss_image_table = sdss_image_service.search(pos=pos, size=0, format=None)
     50 # Find the first SDSS r-band image.
     51 sdss_rband_record = None

File ~/work/navo-workshop/navo-workshop/.tox/py38-test-oldestdeps/lib/python3.8/site-packages/pyvo/registry/regtap.py:709, in RegistryResource.search(self, *args, **keys)
    704 if not self.service:
    705     raise dalq.DALServiceError(
    706         "resource, {}, is not a searchable service".format(
    707             self.short_name))
--> 709 return self.service.search(*args, **keys)

File ~/work/navo-workshop/navo-workshop/.tox/py38-test-oldestdeps/lib/python3.8/site-packages/pyvo/dal/sia.py:255, in SIAService.search(self, pos, size, format, intersect, verbosity, **keywords)
    188 def search(
    189         self, pos, size=1.0, format='all', intersect="overlaps",
    190         verbosity=2, **keywords):
    191     """
    192     submit a SIA query to this service with the given parameters.
    193 
   (...)
    253     pyvo.dal.query.DALQueryError
    254     """
--> 255     return self.create_query(
    256         pos, size, format, intersect, verbosity, **keywords).execute()

File ~/work/navo-workshop/navo-workshop/.tox/py38-test-oldestdeps/lib/python3.8/site-packages/pyvo/dal/sia.py:572, in SIAQuery.execute(self)
    558 def execute(self):
    559     """
    560     submit the query and return the results as a SIAResults instance
    561 
   (...)
    570        for errors parsing the VOTable response
    571     """
--> 572     return SIAResults(self.execute_votable(), url=self.queryurl, session=self._session)

File ~/work/navo-workshop/navo-workshop/.tox/py38-test-oldestdeps/lib/python3.8/site-packages/pyvo/dal/query.py:246, in DALQuery.execute_votable(self, post)
    244 except Exception as e:
    245     self.raise_if_error()
--> 246     raise DALFormatError(e, self.queryurl)

DALFormatError: ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

=============================== warnings summary ===============================
.tox/py38-test-oldestdeps/lib/python3.8/site-packages/_pytest/nodes.py:642: 12 warnings
  /home/runner/work/navo-workshop/navo-workshop/.tox/py38-test-oldestdeps/lib/python3.8/site-packages/_pytest/nodes.py:642: PytestRemovedIn8Warning: The (fspath: py.path.local) argument to IPyNbFile is deprecated. Please use the (path: pathlib.Path) argument instead.
  See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path
    return super().from_parent(parent=parent, fspath=fspath, path=path, **kw)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED QuickReference.ipynb::Cell 9
FAILED UseCase_I.ipynb::Cell 31
============ 2 failed, 200 passed, 12 warnings in 305.50s (0:05:05) ============
ERROR: InvocationError for command /home/runner/work/navo-workshop/navo-workshop/.tox/py38-test-oldestdeps/bin/pytest --nbval (exited with code 1)
___________________________________ summary ____________________________________
ERROR:   py38-test-oldestdeps: commands failed
Error: Process completed with exit code 1.
@bsipocz bsipocz added bug Something isn't working content Issues regarding the content of the notebooks labels Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working content Issues regarding the content of the notebooks
Projects
None yet
Development

No branches or pull requests

1 participant