how to use cpu_bound, io_bound? #2018
Replies: 4 comments 7 replies
-
I am interested in where this discussion goes. I find executing arbitrary async functions/methods one of the more challenging aspects of working with NiceGUI currently, doubly so if you are doing any |
Beta Was this translation helpful? Give feedback.
-
@natankeddem - the scan2wiki upload form currently has two long running actions:
|
Beta Was this translation helpful? Give feedback.
-
I hope this explains the intended use of these functions. In our FAQs we also refer to several examples.
I don't quite understand. Both functions return an How to implement a progress bar for a long-running background task? I don't know. We usually try to break up the task into small chunks which can be awaited in a loop, while the progress is updated. If you put a long computation in another process (via |
Beta Was this translation helpful? Give feedback.
-
Question
To implement the nicegui widgets issue refactor to use run module for background tasks #33 i need to understand how to use cpu_bound and io_bound.
Currently there is a background module https://github.com/WolfgangFahl/nicegui_widgets/blob/main/ngwidgets/background.py
with function execute_in_background:
the idea here is that the call immediately returns and with get_result the actual result can be retrieved if need be.
I'd like to add a progress bar functionality here so that generally such tasks are callable with an interface to a progress bar (which might be nicegui ui element or a tqdm progress bar) - this is what https://github.com/WolfgangFahl/nicegui_widgets/blob/main/ngwidgets/progress.py is for.
Since cpu_bound and io_bound don't return a future i don't understand the intended usage of these function or how they'd be integrated in the idea of simply calling something like:
with function being a callable, progress being a progress bar interface, and bound_style specifying io or cpu_bound.
How would this idea be implementable?
Beta Was this translation helpful? Give feedback.
All reactions