refactor(variables): replace deprecated 'get_any' with 'get' method (#9584)

This commit is contained in:
-LAN-
2024-10-22 10:49:19 +08:00
committed by GitHub
parent 5838345f48
commit 8f670f31b8
8 changed files with 95 additions and 77 deletions

View File

@@ -41,10 +41,15 @@ class CodeNode(BaseNode[CodeNodeData]):
# Get variables
variables = {}
for variable_selector in self.node_data.variables:
variable = variable_selector.variable
value = self.graph_runtime_state.variable_pool.get_any(variable_selector.value_selector)
variables[variable] = value
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()
# Run code
try:
result = CodeExecutor.execute_workflow_code_template(