def test_profiler(): out = thread_prof.get(dsk, 'e') assert out == 6 prof_data = sorted(thread_prof.results(), key=lambda d: d.key) keys = [i.key for i in prof_data] assert keys == ['c', 'd', 'e'] tasks = [i.task for i in prof_data] assert tasks == [(add, 'a', 'b'), (mul, 'a', 'b'), (mul, 'c', 'd')] thread_prof.clear() assert thread_prof.results() == []
def test_profiler_plot(): out = thread_prof.get(dsk, 'e') # Run just to see that it doesn't error thread_prof.visualize(show=False) p = thread_prof.visualize(plot_width=500, plot_height=300, tools="hover", title="Not the default", show=False) assert p.plot_width == 500 assert p.plot_height == 300 assert len(p.tools) == 1 assert isinstance(p.tools[0], bokeh.models.HoverTool) assert p.title == "Not the default"