Current SOTA on controlling long running processes (start, cancel, etc.)? 🤔

Hi all :wave:

I currently have to implement a start button that kicks off a longer computation. This should show a spinner or progress bar while computing. In the end the result should be downloadable from a link that’s shown after the computation. I also need to have a stop button to cancel the computation.

In addition I think about two scenarios how the user should be able to interact with this:

  • any change of other controls stops the computation and prints a notification badge
  • all other controls are disabled until a stop button is pressed or the file is downloaded

I prefer the second option, but I’m not sure how this can be achieved?

Is there any example around where stuff like this is implemented already? I found bits and pieces but was wondering if there is some code where this comes together.

I’m already using SessionState from the multi-page setup example from the forums to preserve state of my configuration…


You will probably want to spin off the computation into a separate thread. You should be able to end or affect or end the thread within a st.button press if statement.