3

My Dask .visualize() does not show the graph properly. The code was taken from http://github.com/dask/dask-tutorial/ 01_dask.delayed.ipynb notebook.

I installed graphviz using pip and apt. Even though the graph is displayed, it is not fully shown. I am running the code on jupyter Lab

def inc(x):
    return x + 1

def double(x):
    return x + 2

def add(x, y):
    return x + y

data = [1, 2, 3, 4, 5]

output = []
for x in data:
    a = inc(x)
    b = double(x)
    c = add(a, b)
    output.append(c)

total = sum(output)

import dask

output = []
for x in data:
    a = dask.delayed(inc)(x)
    b = dask.delayed(double)(x)
    c = dask.delayed(add)(a, b)
    output.append(c)

total = dask.delayed(sum)(output)

total.visualize()  # see image to the right

I expected the boxes in the image to be also filled with data. my output of code

1 Answers1

2

This was a deliberate change in Dask, because we found that the labels of the boxes presented redundant data with names like "inc #1", which, since it comes from a function called "inc" is already obvious. We find the current form to be far clearer. Indeed, the example image should be updated to reflect the change.

You may find it interesting to view the real-time rendering of graphs in the distributed scheduler's graph view, where pointer hover provides more information about a given node and its current status.

mdurant
  • 27,272
  • 5
  • 45
  • 74
  • If we wanted to customize the output, what would the recommended area to focus on be? – user7038639 Feb 12 '20 at 00:21
  • There is a not a single function, but the code to traverse the graph, convert to graphviz and then interpret and render is not at all deep, see `dask.base.visualize()` and `dask.dot` module. – mdurant Feb 12 '20 at 14:36