Replies: 6 comments 6 replies
-
Questions:
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Graphviz is a well supported and extensible renderer for graph objects. A key limitation is that many attributes, including Also, Anyhow, all of this to say that everything is simpler if we can style the entire graph "at once". |
Beta Was this translation helpful? Give feedback.
-
We could also use the tags to display things from the function: e.g. documentation & source code? |
Beta Was this translation helpful? Give feedback.
-
Another approach that could be beneficial is enabling the export of the graph into a JSON file. Currently, users are limited to consuming the graph as an image file generated by Graphviz. This prevents the use of other visualization libraries or displaying the graph in text form. One possible solution, is to expose a method on the driver that would create a JSON representation of the graph. It could work something like this: # main.py
from hamilton import driver
import functions
dr = driver.Builder().with_modules(functions).build()
# Create JSON file of the Graph
dr.export_json("./my-graph.json") Users could then use the JSON to create a visualization in anyway they choose. Eg: use D3 or display in an HTML table. |
Beta Was this translation helpful? Give feedback.
-
This has been shipped as part of |
Beta Was this translation helpful? Give feedback.
-
Context
From slack:
What can be done today
You can post process the graph returned:
What could be done by the framework?
Idea 1: Expose callback
Expose a callback function to enable the above to be within the framework:
Idea 2: decorate functions
Then when you use any of the display/visualize functions, it'll use what was annotated on the functions. But this
requires all functions that are to receive special treatment, to be annotated -- so it might mean that every function
has
@custom_node_type
?Idea 3: do some combination of the above
Shift left is nice, but it could mean that things are verbose if applied to many functions. So we could allow/work with a combination. E.g. apply decorator first, and then apply any other functions.
Idea 4: Allow JSON export
We could also provide a more flexible export format for people to plug into their system of choice. "dot" files aren't that standard.
E.g. #635 show a prototype of this.
This option wouldn't conflict with having the others, as it would facilitate an escape hatch.
Got more ideas? add comments, and I'll update to expose them here. Else please provide comments.
Prototype
See current prototype here that does (3) - #642.
Beta Was this translation helpful? Give feedback.
All reactions