mynameisedgar_
Code not executed as expected
Hey Guys, I am using pythons dash package to build a website. My application is somewhat compute intensive. That is why I want to compute the results when the server starts, so that the website can use the cached results and is more responsive. But the code for the pre-computation is not being executed.
Right now the website consists of a single app.py file that contains the dash code.
At the top of my program I call:
Then comes my function definition precompute_and_save_figures() and below that all of the dash definitions for the website.
At the bottom I have my name equals main check and start the application:
Locally, on my Windows PC this works just fine and it computes all of the results I need. So I think it has something to do with the Procfile and how the Code is being executed. The Procfile looks like this:
When I deploy this I think it should at least print out the logging statements in the Deploy Logs. But that isn't the case. I also know it did not do the computation beforehand since the application is very slow.
How can I fix this? I appreciate your help!
Edit: I think I should also mention that the precompute_and_save_figures() function uses multiprocessing so it needs to be ecapsulated in a name == main block.
224 replies