MCPcopy Index your code
hub / github.com/dask/dask / plot_tasks

Function plot_tasks

dask/diagnostics/profile_visualize.py:139–244  ·  view source on GitHub ↗

Visualize the results of profiling in a bokeh plot. Parameters ---------- results : sequence Output of Profiler.results dsk : dict The dask graph being profiled. start_time : float Start time of the profile in seconds end_time : float End time

(
    results, dsk, start_time, end_time, palette="Viridis", label_size=60, **kwargs
)

Source from the content-addressed store, hash-verified

137
138
139def plot_tasks(
140 results, dsk, start_time, end_time, palette="Viridis", label_size=60, **kwargs
141):
142 """Visualize the results of profiling in a bokeh plot.
143
144 Parameters
145 ----------
146 results : sequence
147 Output of Profiler.results
148 dsk : dict
149 The dask graph being profiled.
150 start_time : float
151 Start time of the profile in seconds
152 end_time : float
153 End time of the profile in seconds
154 palette : string, optional
155 Name of the bokeh palette to use, must be a member of
156 bokeh.palettes.all_palettes.
157 label_size: int (optional)
158 Maximum size of output labels in plot, defaults to 60
159 **kwargs
160 Other keyword arguments, passed to bokeh.figure. These will override
161 all defaults set by visualize.
162
163 Returns
164 -------
165 The completed bokeh plot object.
166 """
167 bp = import_required("bokeh.plotting", _BOKEH_MISSING_MSG)
168 from bokeh.models import HoverTool
169
170 defaults = dict(
171 title="Profile Results",
172 tools="hover,save,reset,xwheel_zoom,xpan",
173 toolbar_location="above",
174 width=800,
175 height=300,
176 )
177 # Support plot_width and plot_height for backwards compatibility
178 if "plot_width" in kwargs:
179 kwargs["width"] = kwargs.pop("plot_width")
180 if "plot_height" in kwargs:
181 kwargs["height"] = kwargs.pop("plot_height")
182 defaults.update(**kwargs)
183
184 if results:
185 keys, tasks, starts, ends, ids = zip(*results)
186
187 id_group = groupby(itemgetter(4), results)
188 timings = {
189 k: [i.end_time - i.start_time for i in v] for (k, v) in id_group.items()
190 }
191 id_lk = {
192 t[0]: n
193 for (n, t) in enumerate(
194 sorted(timings.items(), key=itemgetter(1), reverse=True)
195 )
196 }

Callers 1

_plotMethod · 0.90

Calls 5

import_requiredFunction · 0.90
itemgetterClass · 0.85
get_colorsFunction · 0.85
popMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…