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.
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.
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!
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.