In the Link SDK, pipelines can be created in two ways.

  • Creation of pipelines through the use of the class LinkPipeline (here)
  • Creation of a pipeline using the create_link_pipeline method (here)

This document describes how to create a pipeline through the pipeline creation class.

Create a pipeline through the use of the class LinkPipeline

It is possible to create an empty pipeline object and later create and add components to it. In addition, it is possible to create a graph and parameter object and place it within the LinkPipeline class.

LinkPipeline(
    identifier: Optional[str] = None,
    graph: Optional[MRXLinkDagModel] = None,
    parameters: Optional[List[MRXLinkPipelineParameterModel]] = None,
)
  • Parameters
    • identifier(str): ID of pipeline (UUID is automatically generated if not entered)
    • graph(Object): Graph object created by the create_link_graph method (create_link_graph)
    • parameters(Object): Pipeline parameter object list created by the create_link_parameter method (create_link_parameter)
  • Returns
    • LinkPipeline
  • Troubleshooting
    • RuntimeError: User configuration is required.
      For user configuration, try 'mrx-link login' in the command line interface.
      • This occurs when user configuration is required.
    • ConnectionError: Check your internet connection and try again.
      • This occurs when there is an Internet request error or timeout.
    • ValueError: Invalid email or product key. Please check your email and product key again.
      • This occurs when the email or product key value is incorrect.
    • ConnectionError: An unknown error occurred. If the problem continues, visit https://makinarocks-link.readme.io/discuss for discussion, or https://link.makinarocks.ai/technical_support/ for technical support.
      • This occurs when an unknown error happens when connecting to the internet.
    • ValueError: Pipeline parameter names should not be duplicated: ['name']
      • This occurs when pipeline parameter names are duplicated.

Example - Create an empty pipeline object, then add components

Sample Code

from mrx_link.sdk import LinkPipeline
from mrx_link.sdk.utils import * 

# 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)

    # Create edges
    pipeline.add_edge(parent_id="111-1", child_id="222")
    pipeline.add_edge(parent_id="111-2", child_id="222")

    # Print the structure of the pipeline
    pipeline.print()

Output

##### PIPELINE #####
ID     Name    Status    Parent IDs
-----  ------  --------  ------------------
111-1  test1   Ready     []
111-2  test2   Ready     []
222    test3   Ready     ['111-1', '111-2']

##### PARAMETERS #####
Name    Type    Value
------  ------  -------

Example - Make a LinkPipeline class using the graph and parameter objects

from mrx_link.sdk import LinkPipeline
from mrx_link.sdk.utils import (
    create_link_component,
    create_link_edge,
    create_link_graph,
    create_link_parameter,
    create_link_pipeline
)

# 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)

    # Create an edge
    edge1 = create_link_edge(parent_id="111-1", child_id="111-2")

    # Create a graph
    graph = create_link_graph(
    components=[component1, component2],
    edges=[edge1]
    )

    # Create pipeline parameter
    parameter1 = create_link_parameter(name="x", value=123)
    parameter2 = create_link_parameter(name="y", value="baregasdv")
    parameters = [parameter1, parameter2]

    # Create a pipeline by inserting a graph and a pipeline parameter object
    pipeline = LinkPipeline(graph=graph, parameters=parameters)

    # Print the structure of the pipeline
    pipeline.print()

Output

##### PIPELINE #####
ID     Name    Status    Parent IDs
-----  ------  --------  ------------
111-1  test    Ready     []
111-2  test2   Ready     ['111-1']

##### PARAMETERS #####
Name    Type    Value
------  ------  -----------
x       int     123
y       str     "baregasdv"