Hi Everyone,
I’m having an issue deploying Dash to Heroku, as I have a statistical algorithm (multivariate time series) embedded in a callback function (to dynamically change the forecast period). However, the calculation takes about 1.5 minutes, and Heroku throws an H12 error after 30 seconds. I have read a few posts on this forum, one someone posted boiler plate code to run background processes…which seems really complicated, and another about Celery. I’ve tried to implement Redis and queue the specific algorithm calls, but that didn’t do anything. I’ve also followed Herokus website for deploying Redis Queue, also nothing. Does anyone have any recommendations? Maybe not using Heroku to avoid the 30 second timeout? Is there not any easier way to force dash to run computationally expensive callbacks in the background? Happy to post code, although it’s a bit long. Since we’re all stuck at home, seemed like a good time to work on these problems. Really enjoying Dash otherwise.
Thanks!
Hello,
I signed up because I am facing the same problem.
I’m thinking it might be a problem of optimizing my code. I have the app.py file and then I have a separate file which does all the work. This involves importing a spreadsheet into Pandas, doing some operations and generating the plots. I then do a star import (I know…) in the app.py file. So now I’m thinking that the code might be repeating all the computations every time it gets a request. Which is not what I want. Actually, I would like those computations to be done once a day at most, and for the app to serve a daily snapshot of the data. I’m wondering how I might do this. This is quite difficult for me at the moment because it’s the first time I do it.
Hi,
Did you ever solve this? I am having exactly the same problem.
Cheers.
The issue was the algorithm takes too long to process the data, so the sever times out. The default timeout is 30 seconds. I ended up having to process the data in an EC2 instance and store predictions in a separate database. Dash really is just a front for displaying light weight visuals. Not designed for heavy computational tasks. If anyone else knows a better way in Dash, I’d love to hear it
Do you get an error like this???
dash_renderer.v1_2_2m1591041481.min.js:20 POST https://plant-data.apphn.ocp.na.xom.com/_dash-update-component 502 (Proxy Error)
Hi I encountered this error as well. I used Gunicorn and what I did was to include the timeout param in my Procfile file.
web: gunicorn main:server --timeout 120
That worked for me!