astropy / astroquery

Functions and classes to access online data resources. Maintainers: @keflavich and @bsipocz and @ceb8
http://astroquery.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
696 stars 397 forks source link

Cache issues with JPLhorizons #2237

Closed Mdevogele closed 2 years ago

Mdevogele commented 2 years ago

Hi,

I encountered this issue with JPLHorizons, but it might be present for other services.

For a brief moment, the Horizons API was returning errors to my queries. Those queries have been stored in the cache although astroquery was recognizing them as faulty queries. It resulted that when the issue was fixed on the Horizons side, my astroquery queries were still returning the same error as it was using the cache and was not trying to query Horizons again.

I thus had to add a try and catch to all my programs to avoid this issue and using a cache=False when the regular call with the cache fails while this could be built in the JPLHorizons module to not store the cache when the query fails

For the example, here was the error that the JPLHorizons was returning to me was:

ValueError: Query failed without known error message; received the following response: BATVAR: no TLIST values found (or missing quotes) WLDINI: error loading execution-control file.

Thanks!

msakikasm commented 2 years ago

I have had the same issue. Did you find the way to fix this? @Mdevogele

Mdevogele commented 2 years ago

I did not fix it inside astroquery itself, but I got around it by using a try and except If the request fails with a ValueError, it tries again without looking for a cache file.

try: eph = obj.ephemerides() except ValueError: eph = obj.ephemerides(cache=False)

bsipocz commented 2 years ago

cc @mkelley, though this is not a unique issue to jplhorizons and @keflavich added a fix for the same issue for simbad in https://github.com/astropy/astroquery/pull/2187, something similar should do the trick here.