expose the interactive datashader map of NYC taxi data as a Panel (https://panel.holoviz.org/) application
Where I am now:
panel serve 2-dataframes-at-scale.ipynb --show runs a panel application showing (just to make iteration faster for now) a subset of the data using a LocalCluster
Where I'm stuck:
if I load the application in multiple tabs and play with it in both, I get ValueError: Inputs contain futures that were created by another client. and all but one of the tabs are broken
Next steps if I get past this:
switch to a Coiled cluster w/ bigger data
learn how to use pn.state.cache to cache some shared state (e.g. a reference to the cluster, and how to find the already-loaded dataset in the cluster)
```
panel serve 2-dataframes-at-scale.ipynb --show
2022-12-10 09:41:19,417 Starting Bokeh server version 2.4.3 (running on Tornado 6.2)
2022-12-10 09:41:19,417 User authentication hooks NOT provided (default user enabled)
2022-12-10 09:41:19,418 Bokeh app running at: http://localhost:5006/2-dataframes-at-scale
2022-12-10 09:41:19,418 Starting Bokeh server with process id: 97777
hello!!!
/Users/davidchudzicki/dask-tutorial/2-dataframes-at-scale.ipynb:108: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
" \n",
/Users/davidchudzicki/dask-tutorial/2-dataframes-at-scale.ipynb:111: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
"\n",
WARNING:param.RGBPlot00990: Due to internal constraints, when aspect and width/height is set, the bokeh backend uses those values as frame_width/frame_height instead. This ensures the aspect is respected, but means that the plot might be slightly larger than anticipated. Set the frame_width/frame_height explicitly to suppress this warning.
2022-12-10 09:41:48,648 Due to internal constraints, when aspect and width/height is set, the bokeh backend uses those values as frame_width/frame_height instead. This ensures the aspect is respected, but means that the plot might be slightly larger than anticipated. Set the frame_width/frame_height explicitly to suppress this warning.
^C
Interrupted, shutting down
(dask-tutorial-panel) (main *) /Users/davidchudzicki/dask-tutorial $
panel serve 2-dataframes-at-scale.ipynb --show
2022-12-10 09:42:04,607 Starting Bokeh server version 2.4.3 (running on Tornado 6.2)
2022-12-10 09:42:04,608 User authentication hooks NOT provided (default user enabled)
2022-12-10 09:42:04,609 Bokeh app running at: http://localhost:5006/2-dataframes-at-scale
2022-12-10 09:42:04,609 Starting Bokeh server with process id: 98437
/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/distributed/node.py:182: UserWarning: Port 8787 is already in use.
Perhaps you already have a cluster running?
Hosting the HTTP server on port 51027 instead
warnings.warn(
2022-12-10 09:42:05,329 State start
2022-12-10 09:42:05,332 Scheduler at: tcp://127.0.0.1:51028
2022-12-10 09:42:05,332 dashboard at: 127.0.0.1:51027
2022-12-10 09:42:05,349 Start Nanny at: 'tcp://127.0.0.1:51031'
2022-12-10 09:42:05,428 Start Nanny at: 'tcp://127.0.0.1:51032'
2022-12-10 09:42:05,436 Start Nanny at: 'tcp://127.0.0.1:51033'
2022-12-10 09:42:05,443 Start Nanny at: 'tcp://127.0.0.1:51034'
2022-12-10 09:42:05,450 Start Nanny at: 'tcp://127.0.0.1:51035'
2022-12-10 09:42:06,573 Register worker
2022-12-10 09:42:06,584 Starting worker compute stream, tcp://127.0.0.1:51050
2022-12-10 09:42:06,584 Starting established connection to tcp://127.0.0.1:51053
2022-12-10 09:42:06,585 Register worker
2022-12-10 09:42:06,586 Starting worker compute stream, tcp://127.0.0.1:51049
2022-12-10 09:42:06,586 Starting established connection to tcp://127.0.0.1:51054
2022-12-10 09:42:06,600 Register worker
2022-12-10 09:42:06,600 Starting worker compute stream, tcp://127.0.0.1:51055
2022-12-10 09:42:06,601 Starting established connection to tcp://127.0.0.1:51061
2022-12-10 09:42:06,602 Register worker
2022-12-10 09:42:06,602 Starting worker compute stream, tcp://127.0.0.1:51057
2022-12-10 09:42:06,602 Starting established connection to tcp://127.0.0.1:51062
2022-12-10 09:42:06,604 Register worker
2022-12-10 09:42:06,604 Starting worker compute stream, tcp://127.0.0.1:51056
2022-12-10 09:42:06,604 Starting established connection to tcp://127.0.0.1:51063
2022-12-10 09:42:06,645 Receive client connection: Client-d1abf140-7898-11ed-8085-1236337d691c
2022-12-10 09:42:06,646 Starting established connection to tcp://127.0.0.1:51064
hello!!!
/Users/davidchudzicki/dask-tutorial/2-dataframes-at-scale.ipynb:110: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
" Dashboard:http://127.0.0.1:50957/status\n",
/Users/davidchudzicki/dask-tutorial/2-dataframes-at-scale.ipynb:113: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
" Total threads: 10\n",
WARNING:param.RGBPlot00990: Due to internal constraints, when aspect and width/height is set, the bokeh backend uses those values as frame_width/frame_height instead. This ensures the aspect is respected, but means that the plot might be slightly larger than anticipated. Set the frame_width/frame_height explicitly to suppress this warning.
2022-12-10 09:42:14,944 Due to internal constraints, when aspect and width/height is set, the bokeh backend uses those values as frame_width/frame_height instead. This ensures the aspect is respected, but means that the plot might be slightly larger than anticipated. Set the frame_width/frame_height explicitly to suppress this warning.
/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/distributed/node.py:182: UserWarning: Port 8787 is already in use.
Perhaps you already have a cluster running?
Hosting the HTTP server on port 51081 instead
warnings.warn(
2022-12-10 09:42:23,451 State start
2022-12-10 09:42:23,454 Scheduler at: tcp://127.0.0.1:51082
2022-12-10 09:42:23,454 dashboard at: 127.0.0.1:51081
2022-12-10 09:42:23,473 Start Nanny at: 'tcp://127.0.0.1:51085'
2022-12-10 09:42:23,473 Start Nanny at: 'tcp://127.0.0.1:51086'
2022-12-10 09:42:23,475 Start Nanny at: 'tcp://127.0.0.1:51087'
2022-12-10 09:42:23,491 Start Nanny at: 'tcp://127.0.0.1:51088'
2022-12-10 09:42:23,509 Start Nanny at: 'tcp://127.0.0.1:51089'
2022-12-10 09:42:24,989 Register worker
2022-12-10 09:42:24,991 Starting worker compute stream, tcp://127.0.0.1:51102
2022-12-10 09:42:24,991 Starting established connection to tcp://127.0.0.1:51115
2022-12-10 09:42:24,992 Register worker
2022-12-10 09:42:24,992 Starting worker compute stream, tcp://127.0.0.1:51103
2022-12-10 09:42:24,992 Starting established connection to tcp://127.0.0.1:51112
2022-12-10 09:42:24,993 Register worker
2022-12-10 09:42:24,993 Starting worker compute stream, tcp://127.0.0.1:51101
2022-12-10 09:42:24,993 Starting established connection to tcp://127.0.0.1:51111
2022-12-10 09:42:24,993 Register worker
2022-12-10 09:42:24,994 Starting worker compute stream, tcp://127.0.0.1:51100
2022-12-10 09:42:24,994 Starting established connection to tcp://127.0.0.1:51114
2022-12-10 09:42:24,994 Register worker
2022-12-10 09:42:24,994 Starting worker compute stream, tcp://127.0.0.1:51104
2022-12-10 09:42:24,994 Starting established connection to tcp://127.0.0.1:51113
2022-12-10 09:42:25,014 Receive client connection: Client-dc9eac1e-7898-11ed-8085-1236337d691c
2022-12-10 09:42:25,014 Starting established connection to tcp://127.0.0.1:51116
hello!!!
/Users/davidchudzicki/dask-tutorial/2-dataframes-at-scale.ipynb:110: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
" Dashboard:http://127.0.0.1:50957/status\n",
/Users/davidchudzicki/dask-tutorial/2-dataframes-at-scale.ipynb:113: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
" Total threads: 10\n",
WARNING:param.RGBPlot01484: Due to internal constraints, when aspect and width/height is set, the bokeh backend uses those values as frame_width/frame_height instead. This ensures the aspect is respected, but means that the plot might be slightly larger than anticipated. Set the frame_width/frame_height explicitly to suppress this warning.
2022-12-10 09:42:32,029 Due to internal constraints, when aspect and width/height is set, the bokeh backend uses those values as frame_width/frame_height instead. This ensures the aspect is respected, but means that the plot might be slightly larger than anticipated. Set the frame_width/frame_height explicitly to suppress this warning.
/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/distributed/node.py:182: UserWarning: Port 8787 is already in use.
Perhaps you already have a cluster running?
Hosting the HTTP server on port 51129 instead
warnings.warn(
2022-12-10 09:42:32,212 State start
2022-12-10 09:42:32,214 Scheduler at: tcp://127.0.0.1:51130
2022-12-10 09:42:32,214 dashboard at: 127.0.0.1:51129
2022-12-10 09:42:32,303 Start Nanny at: 'tcp://127.0.0.1:51134'
2022-12-10 09:42:32,304 Start Nanny at: 'tcp://127.0.0.1:51135'
2022-12-10 09:42:32,305 Start Nanny at: 'tcp://127.0.0.1:51133'
2022-12-10 09:42:32,328 Start Nanny at: 'tcp://127.0.0.1:51136'
2022-12-10 09:42:32,359 Start Nanny at: 'tcp://127.0.0.1:51137'
2022-12-10 09:42:33,477 Register worker
2022-12-10 09:42:33,477 Starting worker compute stream, tcp://127.0.0.1:51149
2022-12-10 09:42:33,477 Starting established connection to tcp://127.0.0.1:51153
2022-12-10 09:42:33,478 Register worker
2022-12-10 09:42:33,478 Starting worker compute stream, tcp://127.0.0.1:51148
2022-12-10 09:42:33,478 Starting established connection to tcp://127.0.0.1:51151
2022-12-10 09:42:33,490 Register worker
2022-12-10 09:42:33,491 Starting worker compute stream, tcp://127.0.0.1:51154
2022-12-10 09:42:33,491 Starting established connection to tcp://127.0.0.1:51156
2022-12-10 09:42:33,528 Register worker
2022-12-10 09:42:33,528 Starting worker compute stream, tcp://127.0.0.1:51157
2022-12-10 09:42:33,528 Starting established connection to tcp://127.0.0.1:51161
2022-12-10 09:42:33,529 Register worker
2022-12-10 09:42:33,529 Starting worker compute stream, tcp://127.0.0.1:51158
2022-12-10 09:42:33,529 Starting established connection to tcp://127.0.0.1:51162
2022-12-10 09:42:33,567 Receive client connection: Client-e1b7d7de-7898-11ed-8085-1236337d691c
2022-12-10 09:42:33,567 Starting established connection to tcp://127.0.0.1:51163
hello!!!
/Users/davidchudzicki/dask-tutorial/2-dataframes-at-scale.ipynb:110: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
" Dashboard:http://127.0.0.1:50957/status\n",
/Users/davidchudzicki/dask-tutorial/2-dataframes-at-scale.ipynb:113: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
" Total threads: 10\n",
WARNING:param.RGBPlot01866: Due to internal constraints, when aspect and width/height is set, the bokeh backend uses those values as frame_width/frame_height instead. This ensures the aspect is respected, but means that the plot might be slightly larger than anticipated. Set the frame_width/frame_height explicitly to suppress this warning.
2022-12-10 09:42:39,572 Due to internal constraints, when aspect and width/height is set, the bokeh backend uses those values as frame_width/frame_height instead. This ensures the aspect is respected, but means that the plot might be slightly larger than anticipated. Set the frame_width/frame_height explicitly to suppress this warning.
WARNING:param.dynamic_operation: Callable raised "ValueError('Inputs contain futures that were created by another client.')".
Invoked as dynamic_operation(height=526, scale=1.0, width=700, x_range=(-74.1102442857143, -73.79091428571431), y_range=(40.623141095057036, 40.900907095057036))
2022-12-10 09:42:42,227 Callable raised "ValueError('Inputs contain futures that were created by another client.')".
Invoked as dynamic_operation(height=526, scale=1.0, width=700, x_range=(-74.1102442857143, -73.79091428571431), y_range=(40.623141095057036, 40.900907095057036))
WARNING:param.dynamic_operation: Callable raised "ValueError('Inputs contain futures that were created by another client.')".
Invoked as dynamic_operation(height=526, scale=1.0, width=700, x_range=(-74.1102442857143, -73.79091428571431), y_range=(40.623141095057036, 40.900907095057036))
2022-12-10 09:42:42,227 Callable raised "ValueError('Inputs contain futures that were created by another client.')".
Invoked as dynamic_operation(height=526, scale=1.0, width=700, x_range=(-74.1102442857143, -73.79091428571431), y_range=(40.623141095057036, 40.900907095057036))
Traceback (most recent call last):
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/plotting/util.py", line 280, in get_plot_frame
return map_obj[key]
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/core/spaces.py", line 1217, in __getitem__
val = self._execute_callback(*tuple_key)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/core/spaces.py", line 984, in _execute_callback
retval = self.callback(*args, **kwargs)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/core/spaces.py", line 582, in __call__
ret = self.callable(*args, **kwargs)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/util/__init__.py", line 1012, in dynamic_operation
key, obj = resolve(key, kwargs)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/util/__init__.py", line 1001, in resolve
return key, map_obj[key]
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/core/spaces.py", line 1217, in __getitem__
val = self._execute_callback(*tuple_key)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/core/spaces.py", line 984, in _execute_callback
retval = self.callback(*args, **kwargs)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/core/spaces.py", line 582, in __call__
ret = self.callable(*args, **kwargs)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/util/__init__.py", line 1013, in dynamic_operation
return apply(obj, *key, **kwargs)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/util/__init__.py", line 1005, in apply
processed = self._process(element, key, kwargs)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/util/__init__.py", line 987, in _process
return self.p.operation.process_element(element, key, **kwargs)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/core/operation.py", line 194, in process_element
return self._apply(element, key)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/core/operation.py", line 141, in _apply
ret = self._process(element, key)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/operation/datashader.py", line 1593, in _process
agg = rasterize._process(self, element, key)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/operation/datashader.py", line 1572, in _process
element = element.map(op, predicate)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/core/data/__init__.py", line 204, in pipelined_fn
result = method_fn(*args, **kwargs)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/core/data/__init__.py", line 1216, in map
return super(Dataset, self).map(*args, **kwargs)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/core/dimension.py", line 700, in map
return map_fn(self) if applies else self
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/core/operation.py", line 214, in __call__
return self._apply(element)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/core/operation.py", line 141, in _apply
ret = self._process(element, key)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/holoviews/operation/datashader.py", line 522, in _process
agg = getattr(cvs, glyph)(dfdata, x.name, y.name, agg_fn, **agg_kwargs)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/datashader/core.py", line 217, in points
return bypixel(source, self, glyph, agg)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/datashader/core.py", line 1253, in bypixel
return bypixel.pipeline(source, schema, canvas, glyph, agg, antialias=antialias)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/datashader/utils.py", line 109, in __call__
return lk[typ](head, *rest, **kwargs)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/datashader/data_libraries/dask.py", line 29, in dask_pipeline
return da.compute(dsk, scheduler=scheduler)[0]
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/dask/base.py", line 600, in compute
results = schedule(dsk, keys, **kwargs)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/distributed/client.py", line 3102, in get
futures = self._graph_to_futures(
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/distributed/client.py", line 3010, in _graph_to_futures
dsk = dsk.__dask_distributed_pack__(self, keyset, annotations)
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/dask/highlevelgraph.py", line 1078, in __dask_distributed_pack__
"state": layer.__dask_distributed_pack__(
File "/opt/miniconda3/envs/dask-tutorial-panel/lib/python3.10/site-packages/dask/highlevelgraph.py", line 391, in __dask_distributed_pack__
raise ValueError(
ValueError: Inputs contain futures that were created by another client.
```
Goal:
Where I am now:
panel serve 2-dataframes-at-scale.ipynb --show
runs a panel application showing (just to make iteration faster for now) a subset of the data using a LocalClusterWhere I'm stuck:
ValueError: Inputs contain futures that were created by another client.
and all but one of the tabs are brokenNext steps if I get past this:
pn.state.cache
to cache some shared state (e.g. a reference to the cluster, and how to find the already-loaded dataset in the cluster)