Normally, I use Streamlit to build dashboards to help users who aren’t familiar with Python to run some basic calculations and receive analysis results. However, I now would like to build a dashboard which will take a set of user inputs and perform calculations which can last up to ~5 hours. In this time, I can’t be sure the user will not accidentally close their browser, so I would like each user to have a unique link, or other unique way to access their specific page which continues running regardless of whether the page is open.
Is this still possible using streamlit?
Thanks for posting!
This will be tricky and probably not suited for Streamlit as it reruns the page from top to bottom on each interaction which will interrupt the running processes.
Here’s what I would advise, offload the long calculations to a backend server and then use Streamlit for user inputs and displaying the results. You could, theoretically, generate a UUID for each user once they enter some input and hit “Run”. The backend would work on the computation and update the database with the status (e.g., “pending”, “processing”, “completed”) and any other relevant info. The user can use the UUID you generated for them to continously check the status of the running task. Once complete the final result can be retrieved from the database.
Let me know if this helpful.
Many thanks for the reply! I think you suggest a good solution - I will have the user enter a job number or other UUID and then run it separately and allow them to check the status and retrieve results once done. I’ll have to think about how to manage this interface between Streamlit to another VM on which the heavy tasks will run, as I haven’t done a task like that before, but I’ll do some research. Thank you!
Awesome! Am glad the suggestion helped. Happy Streamlit-ing!
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.