Render a task graph using dot. If `filename` is not None, write a file to disk with the specified name and extension. If no extension is specified, '.png' will be used by default. Parameters ---------- dsk : dict The graph to display. filename : str or None, op
(dsk, filename="mydask", format=None, **kwargs)
| 238 | |
| 239 | |
| 240 | def dot_graph(dsk, filename="mydask", format=None, **kwargs): |
| 241 | """ |
| 242 | Render a task graph using dot. |
| 243 | |
| 244 | If `filename` is not None, write a file to disk with the specified name and extension. |
| 245 | If no extension is specified, '.png' will be used by default. |
| 246 | |
| 247 | Parameters |
| 248 | ---------- |
| 249 | dsk : dict |
| 250 | The graph to display. |
| 251 | filename : str or None, optional |
| 252 | The name of the file to write to disk. If the provided `filename` |
| 253 | doesn't include an extension, '.png' will be used by default. |
| 254 | If `filename` is None, no file will be written, and we communicate |
| 255 | with dot using only pipes. Default is 'mydask'. |
| 256 | format : {'png', 'pdf', 'dot', 'svg', 'jpeg', 'jpg'}, optional |
| 257 | Format in which to write output file. Default is 'png'. |
| 258 | **kwargs |
| 259 | Additional keyword arguments to forward to `to_graphviz`. |
| 260 | |
| 261 | Returns |
| 262 | ------- |
| 263 | result : None or IPython.display.Image or IPython.display.SVG (See below.) |
| 264 | |
| 265 | Notes |
| 266 | ----- |
| 267 | If IPython is installed, we return an IPython.display object in the |
| 268 | requested format. If IPython is not installed, we just return None. |
| 269 | |
| 270 | We always return None if format is 'pdf' or 'dot', because IPython can't |
| 271 | display these formats natively. Passing these formats with filename=None |
| 272 | will not produce any useful output. |
| 273 | |
| 274 | See Also |
| 275 | -------- |
| 276 | dask.dot.to_graphviz |
| 277 | """ |
| 278 | g = to_graphviz(dsk, **kwargs) |
| 279 | return graphviz_to_file(g, filename, format) |
| 280 | |
| 281 | |
| 282 | def graphviz_to_file(g, filename, format): |
searching dependent graphs…