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

Function visualize

dask/tests/test_order.py:33–85  ·  view source on GitHub ↗

Utility to visualize the raw low level graphs in this tests suite. This automatically generates a set of visualizations with different metrics and writes them out to a file prefixed by the test name and suffixed by the measure used.

(dsk, suffix="", **kwargs)

Source from the content-addressed store, hash-verified

31
32
33def visualize(dsk, suffix="", **kwargs):
34 """Utility to visualize the raw low level graphs in this tests suite. This
35 automatically generates a set of visualizations with different metrics and
36 writes them out to a file prefixed by the test name and suffixed by the
37 measure used."""
38 funcname = inspect.stack()[1][3] + suffix
39 if hasattr(dsk, "__dask_graph__"):
40 dsk = (
41 collections_to_expr([dsk], optimize_graph=True).optimize().__dask_graph__()
42 )
43
44 node_attrs = {"penwidth": "6"}
45 visualize_dsk(dsk, filename=f"{funcname}.pdf", node_attr=node_attrs, **kwargs)
46 o = order(dsk, return_stats=True)
47 visualize_dsk(
48 dsk,
49 o=o,
50 filename=f"{funcname}-order.pdf",
51 color="order",
52 node_attr=node_attrs,
53 cmap="viridis",
54 collapse_outputs=False,
55 **kwargs,
56 )
57 visualize_dsk(
58 dsk,
59 o=o,
60 filename=f"{funcname}-age.pdf",
61 color="age",
62 node_attr=node_attrs,
63 cmap="Reds",
64 collapse_outputs=False,
65 **kwargs,
66 )
67 visualize_dsk(
68 dsk,
69 o=o,
70 filename=f"{funcname}-pressure.pdf",
71 color="memorypressure",
72 node_attr=node_attrs,
73 cmap="Reds",
74 collapse_outputs=False,
75 **kwargs,
76 )
77 visualize_dsk(
78 dsk,
79 o=o,
80 filename=f"{funcname}-cpath.pdf",
81 color="cpath",
82 node_attr=node_attrs,
83 collapse_outputs=False,
84 **kwargs,
85 )
86
87
88def _rechunk_merge_graph():

Callers 1

Calls 5

collections_to_exprFunction · 0.90
visualize_dskFunction · 0.90
orderFunction · 0.90
__dask_graph__Method · 0.45
optimizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…