파이프라인 구조 시각화

Python code로 작성된 파이프라인의 구조를 시각화합니다.

📘

시각화된 파이프라인 구조를 확인하려면 Graphviz 소프트웨어가 OS에 설치되어 있어야 합니다. Graphviz 소프트웨어를 설치하려면 다음 URL을 참고하십시오. (here)

pipeline.draw(file_path="str")
  • Parameters
    • file_path(str): (Optional) 파이프라인 이미지(PNG)를 저장하고자 하는 파일 경로
  • Troubleshooting
    • OSError: To view the pipeline structure visualized, you must install Graphviz on the OS. To install Graphviz, visit https://graphviz.org/download/
    • OS에 GraphViz 소프트웨어가 설치되지 않았을 경우 발생합니다.

Example

from mrx_link.sdk.utils import *

# 코드 셀
code1 = """
x = 1
"""
code2 = """
print(f"{x=}, {y=}")
"""

if __name__ == "__main__":
    # 컴포넌트 생성
    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]

    # 컴포넌트 연결 관계 정의
    edge1 = create_link_edge(parent_id="111-1", child_id="111-2")
    edges = [edge1]

    # 파이프라인 파라미터 생성
    parameter1 = create_link_parameter(name="x", value="123")
    parameter2 = create_link_parameter(name="y", value="baregasdv")
    parameters = [parameter1, parameter2]

    # 파이프라인 생성
    pipeline = create_link_pipeline(components=components, parameters=parameters, edges=edges)

    # 파이프라인 구조 시각화
    pipeline.draw()