Visualize the results of profiling in a bokeh plot. Parameters ---------- results : sequence Output of CacheProfiler.results dsk : dict The dask graph being profiled. start_time : float Start time of the profile in seconds end_time : float End
(
results,
dsk,
start_time,
end_time,
metric_name,
palette="Viridis",
label_size=60,
**kwargs,
)
| 358 | |
| 359 | |
| 360 | def plot_cache( |
| 361 | results, |
| 362 | dsk, |
| 363 | start_time, |
| 364 | end_time, |
| 365 | metric_name, |
| 366 | palette="Viridis", |
| 367 | label_size=60, |
| 368 | **kwargs, |
| 369 | ): |
| 370 | """Visualize the results of profiling in a bokeh plot. |
| 371 | |
| 372 | Parameters |
| 373 | ---------- |
| 374 | results : sequence |
| 375 | Output of CacheProfiler.results |
| 376 | dsk : dict |
| 377 | The dask graph being profiled. |
| 378 | start_time : float |
| 379 | Start time of the profile in seconds |
| 380 | end_time : float |
| 381 | End time of the profile in seconds |
| 382 | metric_name : string |
| 383 | Metric used to measure cache size |
| 384 | palette : string, optional |
| 385 | Name of the bokeh palette to use, must be a member of |
| 386 | bokeh.palettes.all_palettes. |
| 387 | label_size: int (optional) |
| 388 | Maximum size of output labels in plot, defaults to 60 |
| 389 | **kwargs |
| 390 | Other keyword arguments, passed to bokeh.figure. These will override |
| 391 | all defaults set by visualize. |
| 392 | |
| 393 | Returns |
| 394 | ------- |
| 395 | The completed bokeh plot object. |
| 396 | """ |
| 397 | bp = import_required("bokeh.plotting", _BOKEH_MISSING_MSG) |
| 398 | from bokeh.models import HoverTool |
| 399 | |
| 400 | defaults = dict( |
| 401 | title="Profile Results", |
| 402 | tools="hover,save,reset,wheel_zoom,xpan", |
| 403 | toolbar_location="above", |
| 404 | width=800, |
| 405 | height=300, |
| 406 | ) |
| 407 | # Support plot_width and plot_height for backwards compatibility |
| 408 | if "plot_width" in kwargs: |
| 409 | kwargs["width"] = kwargs.pop("plot_width") |
| 410 | if BOKEH_VERSION().major >= 3: |
| 411 | warnings.warn("Use width instead of plot_width with Bokeh >= 3") |
| 412 | if "plot_height" in kwargs: |
| 413 | kwargs["height"] = kwargs.pop("plot_height") |
| 414 | if BOKEH_VERSION().major >= 3: |
| 415 | warnings.warn("Use height instead of plot_height with Bokeh >= 3") |
| 416 | defaults.update(**kwargs) |
| 417 |
no test coverage detected