본문으로 건너뛰기

flow.node

flow.node(...)flow = px.Flow(...)로 만든 Flow 객체의 메서드입니다. 이 한 줄이 PXFLOW Studio Canvas에 실제 Node 하나를 배치합니다.

Component target의 현재 production 경계

현재 production에서 @px.function target은 실행 가능한 Node를 만듭니다. @px.component는 V1 companion metadata와 exact target/raw settings를 보존하는 contract 경로이며 reader는 이를 read-only unsupported로 표시합니다. exact ProjectScope data-path isolation은 구현됐지만 Project authorization과 execution-trust closure가 닫힐 때까지 production third-party Component install admission과 activation은 차단되고 flow.node(...)가 이를 우회하지 않습니다. successor V2 Canvas는 host-owned component.declarative@2만 사용하고 settings를 component-declared-settings@1로 선언당 최대 8개까지 받고 host control registry가 그립니다. package rich UI는 RFC-016의 component-rich-surface-declaration@1이 소유합니다.

무엇을 만드나요?

현재 Flow에서 실행할 Function Node를 추가합니다. Component target variant는 미래 admitted target의 문법과 현재 read-only recovery를 위해 보존하지만 지금 third-party 실행 Node를 만들지 않습니다. node_key는 이 Flow 안에서 Node를 계속 구분하는 고유한 이름입니다.

Studio에서는 어디에 보이나요?

target 종류에 맞는 Node로 보입니다.

targetStudio의 Node편집 위치
project의 @px.functionFunction Reference NodeDefinitions → Functions
import한 @px.componentread-only unsupported Component Nodeexact target/raw settings 확인; settings UI와 전용 editor는 계획

현재 @px.component는 companion metadata, annotation-derived input/result와 px.Settings 선언을 등록합니다. package renderer·modal은 받지 않고, settings schema는 component-declared-settings@1이, editor는 RFC-016의 component-rich-surface-declaration@1이 소유합니다. host presentation은 Node presentation과 third-party UI가 소유합니다.

문법

python
flow.node(node_key, target, *, settings=None, client=None)

최소 예제

python
from pipelinexlab import px


class AreaResults(px.Results):
    area: float = px.result(unit="m2", description="Section area.")


@px.function(
    key="calculate_area",
    version="1.0.0",
    description="Calculates rectangular section area.",
)
def calculate_area(
    width: float = px.input(unit="m", description="Section width."),
    depth: float = px.input(unit="m", description="Section depth."),
) -> AreaResults:
    return AreaResults(area=width * depth)


flow = px.Flow(
    "section_properties",
    label="Section properties",
    description="Calculates section properties.",
)
area = flow.node("section_area", calculate_area)

매개변수

이름설명
node_key현재 Flow에서 Node를 구분하는 lower_snake_case 고유 이름
target현재 실행할 @px.function, 또는 contract-only/read-only recovery용 imported @px.component
settingscurrent V1 Component recovery가 그대로 보존할 schema 없는 raw object. successor V2 authoring에서는 component-declared-settings@1 선언당 최대 8개
client이 배치를 해석할 px.Client. 생략하면 살아 있는 px.Client가 정확히 하나일 때 그것을 사용하고, 0개거나 2개 이상이면 refusal입니다. Client를 두 개 이상 열어 두었다면 반드시 지정하십시오

반환값과 handle

Node handle을 반환합니다. 이름 있는 input과 result port를 이 handle에서 선택합니다.

python
width = flow.input("width", float, unit="m", description="Section width.")
depth = flow.input("depth", float, unit="m", description="Section depth.")
flow.connect(width, area.inputs.width)
flow.connect(depth, area.inputs.depth)
flow.result("area", area.results.area, description="Calculated section area.")

규칙과 진단

  • 같은 node_key를 두 번 사용할 수 없습니다.
  • decorator 없는 Python 함수는 Function에서는 helpers=[...]로 선언한 helper로, Component에서는 executor module 안의 helper로 사용합니다. Node target은 explicit stable key를 가진 @px.function 또는 @px.component입니다.
  • import한 px.Flow 객체는 일반 Node target이 아닙니다. flow.subflow(...)로 배치합니다.
  • input 값을 settings에 넣지 않습니다. 값의 관계는 flow.connect(...)로 연결합니다.
  • Function 실행 실패는 PX_FUNCTION_FAILED로 정규화됩니다. PX_COMPONENT_FAILED는 admission을 통과한 future Component target의 stable diagnostic 의미이며 현재 차단된 third-party Run을 활성화하지 않습니다.

다음