jupyter-plotly-dash icon indicating copy to clipboard operation
jupyter-plotly-dash copied to clipboard

Sharing data between callbacks error

Open vinaykumar80 opened this issue 6 years ago • 4 comments

Hi,

I am trying to execute the example code given in Dash user guide and documentation explaining Caching and Signaling concept of Sharing data between callbacks - https://dash.plot.ly/sharing-data-between-callbacks , when I try to integrate this code in JupyterDash and run in notebook cell it gives me the following error:

AttributeError Traceback (most recent call last) in 18 #app = dash.Dash(name, external_stylesheets=external_stylesheets) 19 app=JupyterDash('Caching and Signaling') ---> 20 cache = Cache(app.server, config={ 21 'CACHE_TYPE': 'redis', 22 # Note that filesystem cache doesn't work on systems with ephemeral

AttributeError: 'JupyterDash' object has no attribute 'server'

Am I doing something wrong here or how can we get this example working in Jupyter-plotly-dash? Complete code file (.py) is attached in the zip file

Thanks!

vinaykumar80 avatar Feb 15 '19 14:02 vinaykumar80

@GibbsConsulting : Did you get a chance to look into above question? Please let me know if you need additional information.

Thanks!

vinaykumar80 avatar Feb 19 '19 18:02 vinaykumar80

If you are going to remain within a Jupyter notebook, then you can use the notebook environment to store state. This would avoid the need to use an external cache or similar, but at the same time would require code changes to not use the cache.

Going forward, we could add a cache variant to make this relatively transparent. See GibbsConsulting/django-plotly-dash#120

GibbsConsulting avatar Feb 22 '19 18:02 GibbsConsulting

Ok, are you aware of any example code to store the state within notebook? If yes, it will help me integrating it into dash apps within notebooks.

Regarding the cache variant implementation in jupyter-plotly-dash, is there any tentative timeline as to when this feature could be completed?

Thanks!

vinaykumar80 avatar Feb 23 '19 23:02 vinaykumar80

Just reference a local (to the notebook) variable in a callback. The value used will be that of the time the callback is invoked. Note that changing the value of the variable will not automatically propagate to the Dash app until a callback is invoked.

delsim avatar Feb 24 '19 14:02 delsim