-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async progress bar #6
Comments
It is possible already! I didn't include the background task code itself in the library yet, as it's a bit rough around the edges still and therefore still part of our in house app, not the library. That said, I'm pasting it here as-is (licensed as the rest of the library) so that you can adapt it to your code base. Just note that something along these lines will be included in the library in the future, but possibly with a slightly different API:
Example task using the above:
|
Thanks for a very nice reply, I had a quick look at it and I might miss something obvious but I do not get how to implement your suggestion in a tiny example like this (which I run with
As the script runs now, when I click the button, nothing happens for 10 seconds then the progress bar gets complete at once. How can I include the |
So... the problem w your code is that you're busy-waiting in the Run the code in a thread (like my BackgroundTask), or break it up into multiple smaller functions, and use curdoc().add_next_tick_callback() to call the next one. |
For real long-running work, the next_tick_callback approach becomes really impractical, and I strongly suggest using threads. Note that background threads can not generally call bokeh methods, really only add_next_tick_callback, so your code would have to wrap the progressbar.set() call inside a function that you give to add_next_tick_callback (this is most of what my BackgroundTask class does). |
Wow after some hours spent on this I finally got a small working example 😄
|
Thanks for a nice lib, it would be really nice if it was possible to async the set progress during a long python calculation, is this possible or is this all ready possible today and I missed how to implement it correctly?
The text was updated successfully, but these errors were encountered: