fix: Support both Logic-Node condition serialization formats
Logic-Nodes were timing out because UI saves condition as:
{operands: [...], operator: "and"}
But Backend expected:
{expression: {operands: [...], operator: "and"}}
This caused node.condition.expression to be None, triggering:
- Logic-Node failures
- Join-Node wait_all timeout
- 504 Gateway Timeout
Fix: Accept both formats by checking for operator/operands attributes
directly on condition, falling back to condition.expression.
Fixes: 504 Gateway Timeout in Training-Tiefenanalyse workflow
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
60f6cf3c6d
commit
e915d3fb13
|
|
@ -398,8 +398,26 @@ def execute_logic_node(
|
||||||
started_at = datetime.utcnow().isoformat()
|
started_at = datetime.utcnow().isoformat()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not node.condition or not node.condition.expression:
|
if not node.condition:
|
||||||
error_msg = f"Logic node {node.id} has no condition/expression defined"
|
error_msg = f"Logic node {node.id} has no condition defined"
|
||||||
|
logger.error(error_msg)
|
||||||
|
return NodeExecutionState(
|
||||||
|
node_id=node.id,
|
||||||
|
status=NodeStatus.FAILED,
|
||||||
|
error=error_msg,
|
||||||
|
started_at=started_at,
|
||||||
|
completed_at=datetime.utcnow().isoformat()
|
||||||
|
)
|
||||||
|
|
||||||
|
# Handle both serialization formats:
|
||||||
|
# UI format: condition = {operands: [...], operator: "and"}
|
||||||
|
# Expected format: condition = {expression: {operands: [...], operator: "and"}}
|
||||||
|
if hasattr(node.condition, 'operator') and hasattr(node.condition, 'operands'):
|
||||||
|
expression = node.condition # UI format (direct)
|
||||||
|
elif hasattr(node.condition, 'expression'):
|
||||||
|
expression = node.condition.expression # Expected format (wrapped)
|
||||||
|
else:
|
||||||
|
error_msg = f"Logic node {node.id} has invalid condition structure (missing operator/operands)"
|
||||||
logger.error(error_msg)
|
logger.error(error_msg)
|
||||||
return NodeExecutionState(
|
return NodeExecutionState(
|
||||||
node_id=node.id,
|
node_id=node.id,
|
||||||
|
|
@ -410,7 +428,7 @@ def execute_logic_node(
|
||||||
)
|
)
|
||||||
|
|
||||||
# 1. Evaluiere Bedingung
|
# 1. Evaluiere Bedingung
|
||||||
result, error = evaluate_logic_expression(node.condition.expression, context)
|
result, error = evaluate_logic_expression(expression, context)
|
||||||
|
|
||||||
if error:
|
if error:
|
||||||
# Fehler bei Evaluation → Fallback anwenden
|
# Fehler bei Evaluation → Fallback anwenden
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user