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

pyvo queries failing with "file not VOTABLE" error #403

Open
bhilbert4 opened this issue Jan 23, 2023 · 8 comments
Open

pyvo queries failing with "file not VOTABLE" error #403

bhilbert4 opened this issue Jan 23, 2023 · 8 comments
Labels

Comments

@bhilbert4
Copy link

Hello. The pyvo queries that JWQL performs have suddenly started crashing with an error that "File does not appear to be VOTABLE". Here is our query:

import pyvo as vo
instrument = 'nircam'
proposal = 1068
tap_service = vo.dal.TAPService("http://vao.stsci.edu/caomtap/tapservice.aspx")
tap_results = tap_service.search(f"select observationID from dbo.CaomObservation where collection='JWST' and maxLevel=2 and insName like '{instrument.lower()}' and prpID='{int(proposal)}'")
E19                                       Traceback (most recent call last)
~/miniconda3/envs/jwql-py3.8/lib/python3.8/site-packages/pyvo/dal/query.py in execute_votable(self, post)
    241         try:
--> 242             return votableparse(self.execute_stream(post=post).read)
    243         except Exception as e:

~/miniconda3/envs/jwql-py3.8/lib/python3.8/site-packages/astropy/utils/decorators.py in wrapper(*args, **kwargs)
    545 
--> 546             return function(*args, **kwargs)
    547 

~/miniconda3/envs/jwql-py3.8/lib/python3.8/site-packages/astropy/io/votable/table.py in parse(source, columns, invalid, verify, chunk_size, table_number, table_id, filename, unit_format, datatype_mapping, _debug_python_based_parser)
    158             _debug_python_based_parser=_debug_python_based_parser) as iterator:
--> 159         return tree.VOTableFile(
    160             config=config, pos=(1, 1)).parse(iterator, config)

~/miniconda3/envs/jwql-py3.8/lib/python3.8/site-packages/astropy/io/votable/tree.py in parse(self, iterator, config)
   3599                 else:
-> 3600                     vo_raise(E19, (), config, pos)
   3601         config.update(self._get_version_checks())

~/miniconda3/envs/jwql-py3.8/lib/python3.8/site-packages/astropy/io/votable/exceptions.py in vo_raise(exception_class, args, config, pos)
    111         config = {}
--> 112     raise exception_class(args, config, pos)
    113 

E19: None:2:9: E19: File does not appear to be a VOTABLE

During handling of the above exception, another exception occurred:

DALFormatError                            Traceback (most recent call last)
<ipython-input-6-9ab1973090f3> in <module>
----> 1 tap_results = tap_service.search(f"select observationID from dbo.CaomObservation where collection='JWST' and maxLevel=2 and insName like '{instrument.lower()}' and prpID='{int(proposal)}'")

~/miniconda3/envs/jwql-py3.8/lib/python3.8/site-packages/pyvo/dal/tap.py in run_sync(self, query, language, maxrec, uploads, **keywords)
    244         TAPResults
    245         """
--> 246         return self.create_query(
    247             query, language=language, maxrec=maxrec, uploads=uploads,
    248             **keywords).execute()

~/miniconda3/envs/jwql-py3.8/lib/python3.8/site-packages/pyvo/dal/tap.py in execute(self)
    940            for errors parsing the VOTable response
    941         """
--> 942         return TAPResults(self.execute_votable(), url=self.queryurl, session=self._session)
    943 
    944     def submit(self, post=False):

~/miniconda3/envs/jwql-py3.8/lib/python3.8/site-packages/pyvo/dal/query.py in execute_votable(self, post)
    243         except Exception as e:
    244             self.raise_if_error()
--> 245             raise DALFormatError(e, self.queryurl)
    246 
    247     def raise_if_error(self):

DALFormatError: E19: None:2:9: E19: File does not appear to be a VOTABLE
@msdemlei
Copy link
Contributor

msdemlei commented Jan 23, 2023 via email

@bsipocz
Copy link
Member

bsipocz commented Jan 23, 2023

I cannot reproduce it any more so it's difficult to see what's available along with the error message after the initial votable parsing. We would need a toy example that returns this html to test whether the situation could be improved during errorn handling on the pyvo level, or in astropy, during parsing. So it may be possible that the right first step is to upstream this to astropy, even when it will land on the laps of the same people. E.g. it would be nice to fail on this with a more informative error, and parsing that out should be done in astropy.

@theresadower
Copy link
Contributor

Hello! Yes, this issue occurred during scheduled downtime this morning for one MAST catalog, which briefly affected a wider array of our TAP and other services than planned.

If folks think it might be useful to handle this more gracefully in the general case, we can provide an example of this general downtime announcement framework in action. That said, very specifically to TAP, MAST is actively moving services off the platform that had this issue today. The target architecture and its downtime announcements should match our other Python/astropy.mast behavior as we finish this up and port support for each catalog in TAP. (Whether that is any different, I don't actually know, but there are others who can chime in.)

@msdemlei
Copy link
Contributor

msdemlei commented Jan 24, 2023 via email

@andamian
Copy link
Contributor

Does the service return a 200 response status? Shouldn't that be a 503? That (and a simple text body) should make PyVO return the body message.

@bsipocz
Copy link
Member

bsipocz commented Jan 24, 2023

I suppose it would be nice to see more non 200 status codes, but in my experience the behaviours are all over the place, many servers seem to just focus on the browser experience and return a valid 200 with a message about the downtime embedded in the html.

@andamian
Copy link
Contributor

How about the Content-Type header? Not sure if PyVO checks that before attempting to parse the VOTable but it should.

@bsipocz bsipocz added the bug label Jan 24, 2023
@msdemlei
Copy link
Contributor

msdemlei commented Jan 25, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants