In the process of learning dask, I am trying to generate program graph visualizations using the “visualize” method/function. However, I am not working with a notebook. As far as I can tell, there is no way to have dask output these graphs to anything other than an IPython.core.display.Image object, which I don’t know how to view in regular python. For various reasons it’s impractical for me to run my code using IPython.
Is there any way to display these objects in a regular Python script/shell? Or at least, to save them to a standard image file on disk?
.visualize method allows you to specify a filename to output to, and other parameters to be passed to dot/graphviz:
produces a PDF file output instead of attempting an inline representation. Various other graphical formats are supported, such as PNG (although it may depend on how you installed graphviz).
You can also extract the image bytes from the Image instance
im = d.visualize() open('output.png', 'wb').write(im.data)
which will be in PNG format (also given by