I have the missing ReportContext error with the following code:
import streamlit as st
from stqdm import stqdm
from joblib import Parallel, delayed
data = Parallel(n_jobs=-1)(delayed(get_data)(*get_id) \
for get_id in stqdm(request_ids.itertuples(index=False), \
total=request_ids.shape[0])
where my get_data function gets some data using some requests.
the code runs fine without streamlit.
Any ideas ?
from time import sleep
from joblib import Parallel, delayed
import streamlit as st
def get_data(*args):
sleep(0.5)
return args
request_ids = ((str(i),) for i in range(5000))
data = Parallel(n_jobs=-1)(
st.write(get_id) or delayed(get_data)(*get_id) for get_id in request_ids
)
From my understanding so far, itās not directly related with stqdm but more with using streamlit from the main thread of joblib.Parallel (the job provider).
I am not versed enough in joblib.Parallel, but you need to use streamlit.scriptrunner.add_script_run_ctx or your streamlit version equivalent on the thread.
To be honest, I tried to poke a bit around with joblib and streamlit but was not really successful.
My last attempt was to use manager,Namespace(). Unfortunately the context provided by streamlit add_report_ctx was not pickable and I could not really spend more time on it.
I think the question would be best asked to streamlit runner or a joblib expert.
Did you try to create an issue on either of the repos ? I could support you on this.
Hi @Wirg, it seems you didnāt understand was @Bhargav_Choithwani was trying to say. Let me try to demonstrate it with a small reproducible code.
from time import sleep
from stqdm import stqdm
import streamlit as st
submit = st.button('Click me')
if submit:
for _ in stqdm(range(50)):
sleep(0.5)
The problem is, if you stop the execution while a for loop enclosed in stqm is running, in the next re-run the code enclosed in the stqdm-ed for loop becomes non-functional. It reaches executes upto the point of the for loop but no further and just the running indication by streamlit perpetually stays in the top right corner of the screen. It is demonstrated below.
Hope this helps to understand the bug!
Edit: Just wanted to mention, this makes debugging the code enclosed in stqdm very annoying.
Hi, I have exactly the same problem. The progress bar looks awesome, but if you stop it and try to run it again, the bar will just not show up again, just like @PSP and @Bhargav_Choithwani reported. Any updates on this, @Wirg ???
Hi @Wirg,
I am not familiar with either tqdm nor STqdm, so this question might be a bit naive: Is it possible to use STqdm (tqdm) to display some kind of progress bar for a running SQL query that is fired upon clicking a st.button?
I am asking because the tqdm readme mentions in section IPython/Jupyter Integration also a mode for a progress bars without ETA (even though it is not shown in the included images).
Iād imagine that SQL queries wonāt have any ETA, since you wonāt know the number of result records in advance, but still you might be able to display some kind of progress bar thus indicating to the user, that the query is running and retrieving records at the speed of x/sec?
Thank you.
By stopping, I mean pressing the āStopā icon/text/button that is present in the top right corner of any Streamlit app (at least by default). You can see my cursor pressing āStopā in the gif in my previous post.
Yes, it should work with something like this for example.
In general, every tqdm example should work with stqdm.
There are a few limitation mainly with some weird interaction between multithreading and streamlit. But it works in general.
Note, somebody reported that progress without a total or a length is not working in stqdm v0.0.4.
There will be in v0.0.5.
@Wirg this is great and I have been trying to use it in my streamlit app but canāt figure out how to incorporate it in a for loop of user-input URLs. Iāve asked an open question on this on Stackoverflow if you or someone here is looking to beef up their reputation
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.