Forums

My functions take around 15 minutes to run and I am getting Harakiri runtime error

I have some functions in my flaskapp that I call from a front end web app. These api calls can take upwards of 15 minutes, and after about 10 minutes my code stops running no matter where it is in the function and gives me the following error

"2023-07-13 06:40:16 Thu Jul 13 06:40:15 2023 - *** HARAKIRI ON WORKER 2 (pid: 12, try: 1) *** 2023-07-13 06:40:16 Thu Jul 13 06:40:15 2023 - HARAKIRI !!! worker 2 status !!! 2023-07-13 06:40:16 Thu Jul 13 06:40:15 2023 - HARAKIRI [core 0] 10.0.0.83 - POST /generate_analysis since 1689229814 2023-07-13 06:40:16 Thu Jul 13 06:40:15 2023 - HARAKIRI !!! end of worker 2 status !!! 2023-07-13 06:40:16 DAMN ! worker 2 (pid: 12) died, killed by signal 9 :( trying respawn ... 2023-07-13 06:40:16 Respawned uWSGI worker 2 (new pid: 59) 2023-07-13 06:40:16 spawned 2 offload threads for uWSGI worker 2"

Any suggestions as to how to increase the timeout time so that my functions can run this long, or is there another workaround/ fix for this type of issue? Thanks

Sounds like youre doing work in the main request flow that should be broken off into a seperate worker. Take a look at this - https://help.pythonanywhere.com/pages/AsyncInWebApps/