Skip to content

Commit

Permalink
feat(workflow-nodes): handle missing variables without failure (#10471)
Browse files Browse the repository at this point in the history
  • Loading branch information
laipz8200 authored Nov 8, 2024
1 parent 445dcfe commit bf31a3e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
8 changes: 1 addition & 7 deletions api/core/workflow/nodes/code/code_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,7 @@ def _run(self) -> NodeRunResult:
for variable_selector in self.node_data.variables:
variable_name = variable_selector.variable
variable = self.graph_runtime_state.variable_pool.get(variable_selector.value_selector)
if variable is None:
return NodeRunResult(
status=WorkflowNodeExecutionStatus.FAILED,
inputs=variables,
error=f"Variable `{variable_selector.value_selector}` not found",
)
variables[variable_name] = variable.to_object()
variables[variable_name] = variable.to_object() if variable else None
# Run code
try:
result = CodeExecutor.execute_workflow_code_template(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ def _run(self) -> NodeRunResult:
for variable_selector in self.node_data.variables:
variable_name = variable_selector.variable
value = self.graph_runtime_state.variable_pool.get(variable_selector.value_selector)
if value is None:
return NodeRunResult(
status=WorkflowNodeExecutionStatus.FAILED,
error=f"Variable {variable_name} not found in variable pool",
)
variables[variable_name] = value.to_object()
variables[variable_name] = value.to_object() if value else None
# Run code
try:
result = CodeExecutor.execute_workflow_code_template(
Expand Down

0 comments on commit bf31a3e

Please sign in to comment.