MCPcopy Create free account
hub / github.com/dask/dask / visualize

Function visualize

dask/tests/test_order.py:32–84  ·  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

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