Skip to content

uni-flow 公开 API(中文注解)


uni-flow 公开 API(中文注解) / DAGFlow

Class: DAGFlow

Defined in: core/control-flow/dag-delegation-composite.ts:10

DAG ControlFlow:planner 产出计划后,按依赖图调度 executor,最后跑 aggregator。

就绪步骤由 dependencies(stepId → 前置 stepId 列表)决定;完成集合来自 SharedState 的 completedSteps 与引擎的 completedUnits。 也可由 Workflow YAML 的 flow.type: dag 映射而来。

Implements

Constructors

Constructor

new DAGFlow(planner, executors, aggregator, dependencies): DAGFlow

Defined in: core/control-flow/dag-delegation-composite.ts:19

Parameters

planner

WorkflowUnit

负责写入计划(如键 plan)的 Unit

executors

Map<string, WorkflowUnit>

stepId → 执行该步的 Unit

aggregator

WorkflowUnit

所有步骤完成后执行的聚合 Unit

dependencies

Map<string, string[]>

stepId → 其依赖的 stepId 列表(无依赖则为空数组 / 缺省)

Returns

DAGFlow

Properties

type

readonly type: "dag" = 'dag'

Defined in: core/control-flow/dag-delegation-composite.ts:11

Flow 类型名。

Implementation of

ControlFlow.type

Methods

isComplete()

isComplete(state): boolean

Defined in: core/control-flow/dag-delegation-composite.ts:60

Parameters

state

SharedState

当前 SharedState

Returns

boolean

aggregated 是否为 true

Implementation of

ControlFlow.isComplete


next()

next(state, completedUnits?): WorkflowUnit[]

Defined in: core/control-flow/dag-delegation-composite.ts:33

无计划时调度 planner;否则调度所有依赖已满足的 executor;都完成后调度 aggregator。

Parameters

state

SharedState

当前 SharedState(可读 plan / completedSteps / aggregated

completedUnits?

Set<string>

引擎侧已完成 Unit id 集合

Returns

WorkflowUnit[]

本轮可调度的 Unit 列表(可能多个并行步骤)

Implementation of

ControlFlow.next


restore()

restore(_cursor): void

Defined in: core/control-flow/dag-delegation-composite.ts:94

Parameters

_cursor

ControlFlowCursor

先前游标(本实现无本地字段可恢复)

Returns

void

Implementation of

ControlFlow.restore


serialize()

serialize(): ControlFlowCursor

Defined in: core/control-flow/dag-delegation-composite.ts:89

Returns

ControlFlowCursor

游标(DAG 进度主要落在 SharedState,此处 state 为空对象)

Implementation of

ControlFlow.serialize

MIT Licensed