Visualize the pipeline structure.
Visualize the pipeline structure written in Python.
The pipeline structure can be visualized only if Graphviz software is installed on the operating system. Please refer to the following URL to check how to install Graphviz. (here)
pipeline.draw(file_path="str")
- Parameters
file_path
(str): (Optional) file path to save the pipeline image (PNG)
- Troubleshooting
- OSError: To view the pipeline structure visualized, you must install Graphviz on the OS. To install Graphviz, visit https://graphviz.org/download/
- This occurs when GraphViz is not installed in the operating system.
- OSError: To view the pipeline structure visualized, you must install Graphviz on the OS. To install Graphviz, visit https://graphviz.org/download/
Example
from mrx_link.sdk.utils import *
# Code cell
code1 = """
x = 1
"""
code2 = """
print(f"{x=}, {y=}")
"""
if __name__ == "__main__":
# Create components
component1 = create_link_component(identifier="111-1", name="test", code=code1)
component2 = create_link_component(identifier="111-2", name="test2", code=code2)
components = [component1, component2]
# Create edges
edge1 = create_link_edge(parent_id="111-1", child_id="111-2")
edges = [edge1]
# Create pipeline parameters
parameter1 = create_link_parameter(name="x", value="123")
parameter2 = create_link_parameter(name="y", value="baregasdv")
parameters = [parameter1, parameter2]
# Create pipeline
pipeline = create_link_pipeline(components=components, parameters=parameters, edges=edges)
# Visualize the pipeline structure
pipeline.draw()