route those APIs
This commit is contained in:
@@ -18,6 +18,7 @@ from wf_core.run_state import (
|
||||
StepExecutionResult,
|
||||
)
|
||||
from wf_core.runtime.foreach_state import ForeachBarrierState, item_frame_owner
|
||||
from wf_core.runtime.lineage import append_lineage_writes, is_root_lineage_frame
|
||||
from wf_core.runtime.ops.frames import frame_context_values
|
||||
from wf_core.runtime.ops.merges import ReducerDefinition
|
||||
from wf_core.runtime.ops.overlays import state_view_for_frame
|
||||
@@ -120,7 +121,16 @@ def _finalize_node_execution(
|
||||
)
|
||||
owner = item_frame_owner(frame)
|
||||
if owner is None:
|
||||
state_changes = commit_state_patch(run.state, patch)
|
||||
if is_root_lineage_frame(frame):
|
||||
state_changes = commit_state_patch(run.state, patch)
|
||||
else:
|
||||
append_lineage_writes(
|
||||
run,
|
||||
scope_id=frame.scope_id,
|
||||
lineage_id=frame.lineage_id,
|
||||
writes=patch.writes,
|
||||
)
|
||||
state_changes = {}
|
||||
else:
|
||||
parent_frame_id, foreach_node_id, item_index = owner
|
||||
parent_frame = run.frames[parent_frame_id]
|
||||
|
||||
@@ -8,6 +8,9 @@ from wf_core.run_state import (
|
||||
ExecutionFrame,
|
||||
FrameStatus,
|
||||
LineageState,
|
||||
ROOT_FRAME_ID,
|
||||
ROOT_LINEAGE_ID,
|
||||
ROOT_SCOPE_ID,
|
||||
RunState,
|
||||
RunStatus,
|
||||
RuntimeScope,
|
||||
@@ -27,20 +30,25 @@ def create_run_state(workflow: Workflow, workflow_input: dict[str, object]) -> R
|
||||
workflow_input=dict(workflow_input),
|
||||
state=state,
|
||||
scopes={
|
||||
"root": RuntimeScope(
|
||||
id="root",
|
||||
ROOT_SCOPE_ID: RuntimeScope(
|
||||
id=ROOT_SCOPE_ID,
|
||||
workflow_name=workflow.name,
|
||||
committed_state=state,
|
||||
)
|
||||
},
|
||||
lineages={"root": LineageState(id="root", scope_id="root")},
|
||||
current_frame_id="root",
|
||||
lineages={
|
||||
ROOT_LINEAGE_ID: LineageState(
|
||||
id=ROOT_LINEAGE_ID,
|
||||
scope_id=ROOT_SCOPE_ID,
|
||||
)
|
||||
},
|
||||
current_frame_id=ROOT_FRAME_ID,
|
||||
current_node_id=workflow.start,
|
||||
)
|
||||
add_frame(
|
||||
run,
|
||||
ExecutionFrame(
|
||||
id="root",
|
||||
id=ROOT_FRAME_ID,
|
||||
kind="workflow",
|
||||
node_id=workflow.start,
|
||||
status=FrameStatus.PENDING,
|
||||
|
||||
Reference in New Issue
Block a user