Stop (kill) process button (how to stop a stuck / very long process?)

There is the st.stop() , which prevents any further Streamlit code from executing, and there is the [stop] button in the top right, but neither of these do what I am looking for. The [stop] button does pretend to stop things, but the process will whir away (potentially forever), locking the dashboard.

Especially once deployed, the dashboard will need to be easily reset by the user. Hanging runs will be common things, so I am looking for a robust solution.

How can I make a button which will stop, properly, a long-running or stuck process?

For more detail, part of my work involves scipy.optimize.curve_fit, which if it is trying to fit a complex model is very prone to getting itself tangled in mathematical impossibilities. If this was stuck, say in a command line environment, I would just kill the python script which called it. But in this case, the script is the Streamlit code, which can’t be killed and restarted, in a deployment scenario.

Is the solution for Streamlit to start a separate process for potentially-hanging code, and kill them “remotely” through PID? That sounds really undesirable - since so much is happening in session_state for me, messing around back on the command line would be engineering mayhem!

Thanks for any help :slight_smile:

I Have the same problem and need help, please!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.