Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not mark self.stop caller #3335

Merged
merged 2 commits into from
Aug 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/backend/base/langflow/graph/graph/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,24 +782,34 @@ def mark_vertex(self, vertex_id: str, state: str):
if state == VertexStates.INACTIVE:
self.run_manager.remove_from_predecessors(vertex_id)

def mark_branch(self, vertex_id: str, state: str, visited: Optional[set] = None, output_name: Optional[str] = None):
def _mark_branch(
self, vertex_id: str, state: str, visited: Optional[set] = None, output_name: Optional[str] = None
):
"""Marks a branch of the graph."""
if visited is None:
visited = set()
else:
self.mark_vertex(vertex_id, state)
if vertex_id in visited:
return
visited.add(vertex_id)

self.mark_vertex(vertex_id, state)

for child_id in self.parent_child_map[vertex_id]:
# Only child_id that have an edge with the vertex_id through the output_name
# should be marked
if output_name:
edge = self.get_edge(vertex_id, child_id)
if edge and edge.source_handle.name != output_name:
continue
self.mark_branch(child_id, state)
self._mark_branch(child_id, state, visited)

def mark_branch(self, vertex_id: str, state: str, output_name: Optional[str] = None):
self._mark_branch(vertex_id=vertex_id, state=state, output_name=output_name)
new_predecessor_map, _ = self.build_adjacency_maps(self.edges)
self.run_manager.update_run_state(
run_predecessors=new_predecessor_map,
vertices_to_run=self.vertices_to_run,
)

def get_edge(self, source_id: str, target_id: str) -> Optional[CycleEdge]:
"""Returns the edge between two vertices."""
Expand Down
Loading