reichlab / forecast-repository

Codebase for Zoltar forecast repository
https://zoltardata.com/
GNU General Public License v3.0
6 stars 3 forks source link

research ways to catch 503 errors and return a friendlier message #379

Open matthewcornell opened 5 months ago

matthewcornell commented 5 months ago

While developing create a zoltar option in connect_hub() #10, we had some queries fail with 503 errors. From this PR:

I was able to use the function successfully as documented, but got a 503 when connecting to a large hub and grabbing everything.

df <- load_forecasts_zoltar("ECDC European COVID-19 Forecast Hub")
[snip]
get_resource(): GET: https://zoltardata.com/api/job/616053/
QUEUED
get_resource(): GET: https://zoltardata.com/api/job/616053/
QUEUED
get_resource(): GET: https://zoltardata.com/api/job/616053/
SUCCESS
get_resource(): GET: https://zoltardata.com/api/job/616053/data/
Error in get_resource(zoltar_connection, data_url, col_types) : 
  Service Unavailable (HTTP 503).

We need to investigate what exactly is going on, and to determine if we can catch the problem and return a friendly message instead of getting the 503. Note that the code does check for a large number of rows in the result (>2M currently), so I'm not sure what's happening. It might be a timeout in one of the RQ workers (currently 7 min, IIRC).