Skip to content

Commit

Permalink
Fix next node calling logic
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonrising committed May 16, 2024
1 parent eb16a3e commit 4fac432
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,10 @@ def run(self, queue_item: SessionQueueItem):
raise ValueError("Queue item has no session")
invocation = None
# Loop over invocations until the session is complete or canceled
while self.next_invocation(invocation, queue_item, self.cancel_event) and not self.cancel_event.is_set():
# Prepare the next node
invocation = queue_item.session.next()
if invocation is None:
# If there are no more invocations, complete the graph
break
# Build invocation context (the node-facing API
invocation = self.next_invocation(invocation, queue_item, self.cancel_event)
while invocation is not None and not self.cancel_event.is_set():
self.run_node(invocation.id, queue_item)
invocation = self.next_invocation(invocation, queue_item, self.cancel_event)
self.complete(queue_item)

def complete(self, queue_item: SessionQueueItem):
Expand Down

0 comments on commit 4fac432

Please sign in to comment.