Python Asyncio and Dash

Hi,

Has anyone successfully manage running a Dash app using aysncio for Python?

Any examples greatly appreciated.

I have been digging deep into the event loop, co-routines and tasks in asyncio.

Essentially I want to do this:

main_loop()

1. ASYNC - Collect data from web (async call / avoid blocking)
2. ASYNC - Process data (when data is collected from task1)
3. ASYNC - Update data (when data processed from task2) 
4. Display Data using Dash (this should be running constantly of status task 1,2 and 3)

So - how to communicate between tasks, and run the Display (DASH) seperately?

Ideas:

- 2 event loops
- Two thread?

Issues:

- How to communicate between tasks
- How to run the DASH app the whole time whilst the event_loop above also repeats forever / until interrupted (i.e. getData, ProcessData, UpdateDashDisplay...)

Many thanks,
1 Like

I have been having a similar query which I will also ask separately if I don’t find any help here. Attached is a gif of my dashboard built entirely with Plotly and Dash. The data for the dashboard is based out of pandas dataframes. The processing of the pandas dataframes is very quick (max 1-2 seconds) however the call to the server and the loading of the web-app takes between 5-8 seconds for different set of options.

I was wondering - I need 3 Dash Core Components to be updated based on user selection. The data for these are not related to each other as they come from different files. Can this process be handles asynchronously in order to reduce ‘user waiting times’?

Here’s a gif…

Please advice
Cheers
Ananth

I’m curious if you ever figured out how to handle the issues discussed in your post?

thanks!

1 Like