Hi Everyone! I am new to using Streamlit and have a question related to Streamlit app timeout / sleep timer. I created a Streamlit app through my Snowflake database, and it becomes inactive after approximately 15 minutes of being open. Even if i am actively using the app, it still will refresh and become inactive after the 15 minutes. Does anyone know how to fix this? I tried following the instructions in this article ( Additional Streamlit in Snowflake features | Snowflake Documentation but it didnt work. Thanks in advance!
Hi @Malia
I tried custom sleep and it worked without any problems. Did you place the config file in the correct location? It needs to be placed in /.streamlit/config.toml .
For example, in my environment it worked by placing it as follows:
Or, if you uploaded your config.toml with SnowSQL, note that auto_compress must be false! (I often make this mistake myself😂) Also note that you will probably need to restart your app (simply reload your browser) after uploading the config file.
Hi Toru!
Thank you so much for getting back to me!
Ohh that makes sense. I think my problem is that I dropped the file directly into my stage without it being contained within the .streamlit folder.
Problem is that I have tried to upload it contained inside the .streamlit folder, but it tells me that folders are not allowed to be uploaded? Did you upload the file using a SQL Put command or just using the “+ File” button in the Stage itself? I tried using the put command but it always returns an error. I think its related to the stage name needing quotations around it?
Example of the query:
PUT ‘file:///C:.….….streamlit\config.toml’
@UMP_DB_PROD.FINANCE_SCHEMA.“F4G174KISCNOV7HI (Stage)”/.streamlit/
OVERWRITE = TRUE
AUTO_COMPRESS = FALSE;
Any way you can help me figure out what is going wrong? I would really appreciate it!!
Hi @Malia
I uploaded it using the [+] button on the stage. Surely, this is not a little straightforward, but you just specify the folder as shown below and upload the config.toml by itself.
I hope this works!
Omg, duh!! Hahah. Oops. Thank you so much!! Appreciate you taking the time to explain it to me. I’m new to coding and Streamlit, so this is all very new to me.
Hi,
I’ve added the following to the config.toml
file in my Streamlit app:
[snowflake]
[snowflake.sleep]
streamlitSleepTimeoutMinutes = 5
With this setting, I notice that the UI session ends as expected after 5 minutes of inactivity. However, in Snowflake’s history, the query executed by the Streamlit app continues to run even after the UI session has ended.
Additionally, I’m finding the default timeout behavior confusing. When I remain on the page without interacting, the query sometimes runs for more than 15 minutes. I’m not entirely sure what “inactivity” means in this context. Could you help clarify how this setting works and why the query keeps running on Snowflake despite the UI timeout?
Hi,
I am assuming that you have your warehouse auto-stop time set to 10 minutes (default). Therefore, adding up with Streamlit’s auto-stop, I am assuming that the warehouse will stop if not used for 15 minutes. How about this?
If that is the case and you have warehouse operating privileges you can set the auto-stop time of the warehouse to 1 minute, 5 minutes, etc.
alter warehouse {compute_warehouse_name} set AUTO_SUSPEND=60;
Hi @Toru.Hiyama
I create stage and put the toml file in .streamlit folder in my stage
├── environment.yml
├── streamlit_app.py
└── .streamlit/
└── config.toml
this is my config.toml file
[snowflake]
[snowflake.sleep]
streamlitSleepTimeoutMinutes = 50
using i create one streamlit application name ( my_first_app)
but still after inactivity of 15 min my session would stop automatically in streamlit, i dont know why even i put 50 min in the .toml file
my warehouse suspend in 10 min of inactivity
can you please help i want to increase the session time to 50 min
Thank you for asking me!
I tried to reproduce your situaiton, however I could confirm that the app could be finished after 50 mins when I set custom sleep time as 50 mins.
Could you check if you could set config.toml on snowflake stage appropriately or if you could reboot your applications?
As a reference, I attached the config.toml directory and content from screenshot.
I also have done the same thing, still getting error and for your reference I have attached the config.toml directory and snowflake stage screenshots. Now what should I do?
I’ve tried it a few times and it seems to be working fine for me.
It might be a good idea to reach out to Snowflake Support.
If you find anything out, I’d love it if you could share the update here too!
Ok, I will share the update here as soon as I found some solution.
we first create a stage put the files in stage like you do and then execute the command
create or replace streamlit CICD_EXTRACTION_APPLICATION_TESTING from @my_streamlit_stage
and we reboot the application too but still our active session on top box will end after 15 min
well one thing i need to confirm does inactivity of warehouse and streamlit session time is related ?
our warehouse suspend in 10 min of inactivity does it any impact on streamlit session???
or can you show me your yml file and the warehouse size / configuration you have used