I have a Dash Python service with a single callback that produces a number of graphs. The backend is parallelized, but the graphs take varying time to render. Currently, the graphs are displayed, in bulk, only after all of them are ready. However, I think it would be better UX if the webUI displayed each graph as soon as it’s ready, instead of having to wait for all the others. Is there a way to do this?
(I am aware of async-dash and dash-devices, but both projects have their last commit dating back to March 2022 and seem unmaintained.)
Why not to have one callback for each graph ?
The website currently works like this: I fill in some data, press one button, and all the graphs are generated. The only behavior I would like to change is that, instead of all in bulk when they’re all ready, I’d like to display each of the graphs as soon as it’s ready.
If I had one callback per graph, wouldn’t that mean that I have to, say, click multiple buttons (one per graph), in order to generate the graphs? Or is there a way to bind multiple callbacks to a single button, so that they all execute in parallel?
This would be the way to go about it.
If you use de same input in each callback, every time the input change each callback is executed.
And each graph will be updated as soon it´s callback ends.
Also, if there are some process that do the same, you can divide the process in one callback that perform that process and trigger the other callbacks that generate the graphs in order to avoid doing the same in parallel.
Oh, it’s great to hear that it’s possible to do so! Indeed I have some data retrieval that it’s common to all the graphs, and indeed I’d rather not have to repeat it.
So with your suggestions I think I would be able to do this by storing the retrieved raw data to a (possibly hidden) component, and then for each graph have a callback on update of the “data storage” component. Is there a way to do so without having to create a faux component?
I think that dcc.Store allows to do that