파이프라인 내 컴포넌트 연결 관계 추가

📘

create_link_edge 메소드를 통하여 파이프라인 내 컴포넌트의 연결 관계를 추가할 수도 있습니다. (here)

파이프라인에 추가된 컴포넌트들 사이의 부모 자식 관계를 지정합니다. parent_idchild_id에 각각 서로 다른 하나의 하나의 컴포넌트 id 값을 넣어서 edge 정보를 입력합니다.

pipeline.add_edge(parent_id="str", child_id="str")
  • Parameters
    • parent_id(str): 부모 컴포넌트의 ID
    • child_id(str): 자식 컴포넌트의 ID
  • Troubleshooting
    • RuntimeError: The component id does not exist in the pipeline.
      • parent_id 또는 child_id가 파이프라인에 존재하지 않을 경우 발생합니다.
    • RuntimeError: Cannot add an edge between 'component_name1' and 'component_name2': DAG must remain acyclic.
      • DAG 구조가 성립하지 않을 경우에 발생합니다.

Example

from mrx_link.sdk import LinkPipeline
from mrx_link.sdk.utils import create_link_component

# 코드 셀
code1 = """
x = 1
"""
code2 = """
y = 1
z = 1
"""

if __name__ == "__main__":
    # 파이프라인 객체 생성
    pipeline = LinkPipeline()

    # 컴포넌트 생성
    component1 = create_link_component(identifier="111-1", name="test1", code=code1)
    component2 = create_link_component(identifier="111-2", name="test2", code=code2)

    # 파이프라인에 컴포넌트 추가
    pipeline.add_component(component=component1)
    pipeline.add_component(component=component2)

    # 파이프라인 내 컴포넌트 연결 관계 추가
    pipeline.add_edge(parent_id="111-1", child_id="111-2")