Updating interactive plots simultaneously (in parallel) with dask

Hi everyone,

I was speaking with another member of the Pangeo community about some ideas to improve the speed of updating multiple plots with a shared widget and the idea of using something like dask futures to generate plots in parallel came up.

I am trying to visualize a large oceanographic dataset, saved as a netcdf3 file, with various variables. The current workflow is as follows: launch a dask cluster, read in parallel with xarray.open_mfdataset and chunking as necessary, create four contourf plots (rasterized) of different surface variables in a panel gridspec object, tie all four plots to an integer slider widget (for use of xarray.Dataset.isel(time=integer_slider.value), for example).

This works in the sense of updating all plots eventually, but the time it takes to update plots is approximately linear with the number of plots. I imagine each plot is being updated one at a time then all returned at once. We were wondering if there was some way to use dask futures or something similar to update all graphs simultaneously. My first idea would be to have a callback function tied to the integer slider that would spawn dask futures tasks of applying the time selection and updating the plots and then call .result all at once.

Any thoughts on this? Is there something native to holoviz that would work for this?


1 Like

I like the idea! Couple ideas pop up:

Potentially trying:

  1. pn.extension(nthreads=2)
  2. asyncio.gather

Semi relevant:

1 Like