Run a component in the pipeline
Executes the specified component and its parent components, It works in the same manner as Link on Jupyter's Run Component.
pipeline.execute_component(component_id="str")
- Parameters
component_id
(str): ID of the component that is to be executed
- Troubleshooting
RuntimeError: The component id {id} does not exist in the pipeline.
- This occurs when the pipeline does not contain the component id.
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
"""
code3 = """
print(f"{x + y + z = }")
"""
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)
component3 = create_link_component(identifier="222", name="test3", code=code3)
# Add components to the pipeline
pipeline.add_component(component=component1)
pipeline.add_component(component=component2)
pipeline.add_component(component=component3)
# Add edges
pipeline.add_edge(parent_id="111-1", child_id="222")
pipeline.add_edge(parent_id="111-2", child_id="222")
# Run the pipeline component
pipeline.execute_component("111-1")