How to setup a background job?


Its indeed a great tool.

I have a use case in which i want to run a background function which is calling an API on periodic basis and appending some data in a csv file.

The Web interface will give a search opetion to the user to search from this file after some data pre-processing.

Can someone please help me how can i setup this background job continuously no matter what ?


Hi @gladmortal, welcome to the Streamlit community!

For a process like this, having this running inside of Streamlit might not be the best workflow. Meaning, if you want to ping the API at specific intervals, you could create a cron script to do this outside of Streamlit.

Inside of Streamlit, you could load the data using st.cache with a ttl argument, so that the data will stay cached between runs but refresh periodically.