From 61ca2444c05473e10b442e962daffbe77342be32 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Fri, 6 Sep 2024 09:17:36 -0700 Subject: [PATCH] Fix timing of debug task events --- libs/langgraph/langgraph/pregel/runner.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/langgraph/langgraph/pregel/runner.py b/libs/langgraph/langgraph/pregel/runner.py index a2a148d18..c895bf9e9 100644 --- a/libs/langgraph/langgraph/pregel/runner.py +++ b/libs/langgraph/langgraph/pregel/runner.py @@ -38,6 +38,8 @@ def tick( timeout: Optional[float] = None, retry_policy: Optional[RetryPolicy] = None, ) -> Iterator[None]: + # give control back to the caller + yield # execute tasks, and wait for one to fail or all to finish. # each task is independent from all other concurrent tasks # yield updates/debug output as each task finishes @@ -92,6 +94,8 @@ async def atick( retry_policy: Optional[RetryPolicy] = None, ) -> AsyncIterator[None]: loop = asyncio.get_event_loop() + # give control back to the caller + yield # execute tasks, and wait for one to fail or all to finish. # each task is independent from all other concurrent tasks # yield updates/debug output as each task finishes