|
|
|
|
|
|
|
|
and event.node_type == NodeType.LOOP_END |
|
|
and event.node_type == NodeType.LOOP_END |
|
|
and not isinstance(event, NodeRunStreamChunkEvent) |
|
|
and not isinstance(event, NodeRunStreamChunkEvent) |
|
|
): |
|
|
): |
|
|
check_break_result = True |
|
|
|
|
|
yield self._handle_event_metadata(event=event, iter_run_index=current_index) |
|
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
if isinstance(event, NodeRunSucceededEvent): |
|
|
|
|
|
yield self._handle_event_metadata(event=event, iter_run_index=current_index) |
|
|
|
|
|
|
|
|
|
|
|
# Check if all variables in break conditions exist |
|
|
|
|
|
exists_variable = False |
|
|
|
|
|
|
|
|
# Check if variables in break conditions exist and process conditions |
|
|
|
|
|
# Allow loop internal variables to be used in break conditions |
|
|
|
|
|
available_conditions = [] |
|
|
for condition in break_conditions: |
|
|
for condition in break_conditions: |
|
|
if not self.graph_runtime_state.variable_pool.get(condition.variable_selector): |
|
|
|
|
|
exists_variable = False |
|
|
|
|
|
break |
|
|
|
|
|
else: |
|
|
|
|
|
exists_variable = True |
|
|
|
|
|
if exists_variable: |
|
|
|
|
|
|
|
|
variable = self.graph_runtime_state.variable_pool.get(condition.variable_selector) |
|
|
|
|
|
if variable: |
|
|
|
|
|
available_conditions.append(condition) |
|
|
|
|
|
|
|
|
|
|
|
# Process conditions if at least one variable is available |
|
|
|
|
|
if available_conditions: |
|
|
input_conditions, group_result, check_break_result = condition_processor.process_conditions( |
|
|
input_conditions, group_result, check_break_result = condition_processor.process_conditions( |
|
|
variable_pool=self.graph_runtime_state.variable_pool, |
|
|
variable_pool=self.graph_runtime_state.variable_pool, |
|
|
conditions=break_conditions, |
|
|
|
|
|
|
|
|
conditions=available_conditions, |
|
|
operator=logical_operator, |
|
|
operator=logical_operator, |
|
|
) |
|
|
) |
|
|
if check_break_result: |
|
|
if check_break_result: |
|
|
break |
|
|
break |
|
|
|
|
|
else: |
|
|
|
|
|
check_break_result = True |
|
|
|
|
|
yield self._handle_event_metadata(event=event, iter_run_index=current_index) |
|
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
if isinstance(event, NodeRunSucceededEvent): |
|
|
|
|
|
yield self._handle_event_metadata(event=event, iter_run_index=current_index) |
|
|
|
|
|
|
|
|
elif isinstance(event, BaseGraphEvent): |
|
|
elif isinstance(event, BaseGraphEvent): |
|
|
if isinstance(event, GraphRunFailedEvent): |
|
|
if isinstance(event, GraphRunFailedEvent): |