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,
)
| 339 | |
| 340 | |
| 341 | def plot_cache( |
| 342 | results, |
| 343 | dsk, |
| 344 | start_time, |
| 345 | end_time, |
| 346 | metric_name, |
| 347 | palette="Viridis", |
| 348 | label_size=60, |
| 349 | **kwargs, |
| 350 | ): |
| 351 | """Visualize the results of profiling in a bokeh plot. |
| 352 | |
| 353 | Parameters |
| 354 | ---------- |
| 355 | results : sequence |
| 356 | Output of CacheProfiler.results |
| 357 | dsk : dict |
| 358 | The dask graph being profiled. |
| 359 | start_time : float |
| 360 | Start time of the profile in seconds |
| 361 | end_time : float |
| 362 | End time of the profile in seconds |
| 363 | metric_name : string |
| 364 | Metric used to measure cache size |
| 365 | palette : string, optional |
| 366 | Name of the bokeh palette to use, must be a member of |
| 367 | bokeh.palettes.all_palettes. |
| 368 | label_size: int (optional) |
| 369 | Maximum size of output labels in plot, defaults to 60 |
| 370 | **kwargs |
| 371 | Other keyword arguments, passed to bokeh.figure. These will override |
| 372 | all defaults set by visualize. |
| 373 | |
| 374 | Returns |
| 375 | ------- |
| 376 | The completed bokeh plot object. |
| 377 | """ |
| 378 | bp = import_required("bokeh.plotting", _BOKEH_MISSING_MSG) |
| 379 | from bokeh.models import HoverTool |
| 380 | |
| 381 | defaults = dict( |
| 382 | title="Profile Results", |
| 383 | tools="hover,save,reset,wheel_zoom,xpan", |
| 384 | toolbar_location="above", |
| 385 | width=800, |
| 386 | height=300, |
| 387 | ) |
| 388 | # Support plot_width and plot_height for backwards compatibility |
| 389 | if "plot_width" in kwargs: |
| 390 | kwargs["width"] = kwargs.pop("plot_width") |
| 391 | if BOKEH_VERSION().major >= 3: |
| 392 | warnings.warn("Use width instead of plot_width with Bokeh >= 3") |
| 393 | if "plot_height" in kwargs: |
| 394 | kwargs["height"] = kwargs.pop("plot_height") |
| 395 | if BOKEH_VERSION().major >= 3: |
| 396 | warnings.warn("Use height instead of plot_height with Bokeh >= 3") |
| 397 | defaults.update(**kwargs) |
| 398 |
no test coverage detected
searching dependent graphs…