Add an edge in the pipeline
The
create_link_edge
method can also be used to Link pipeline components. (here)
Specify the parent-child relationship between components added to the pipeline. Put a different component ID value in each of the parent and child fields.
pipeline.add_edge(parent_id="str", child_id="str")
- Parameters
parent_id
(str): ID of the parent componentchild_id
(str): ID of the child component
- Troubleshooting
- RuntimeError: The component id does not exist in the pipeline.
- This occurs when
parent_id
orchild_id
does not exist in the pipeline.
- This occurs when
- RuntimeError: Cannot add an edge between 'component_name1' and 'component_name2': DAG must remain acyclic.
- This occurs when the DAG structure is not established.
- RuntimeError: The component id does not exist in the pipeline.
Example
from mrx_link.sdk import LinkPipeline
from mrx_link.sdk.utils import create_link_component
# Code cell
code1 = """
x = 1
"""
code2 = """
y = 1
z = 1
"""
if __name__ == "__main__":
# Create pipeline object
pipeline = LinkPipeline()
# Create components
component1 = create_link_component(identifier="111-1", name="test1", code=code1)
component2 = create_link_component(identifier="111-2", name="test2", code=code2)
# Add components to the pipeline
pipeline.add_component(component=component1)
pipeline.add_component(component=component2)
# Add an edge
pipeline.add_edge(parent_id="111-1", child_id="111-2")