From a436e14fad0ae4e1b7165cbaae231d121ee6fb3c Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Fri, 31 May 2024 15:18:56 -0700 Subject: [PATCH] Rename checkpoint var --- langgraph/channels/base.py | 2 +- langgraph/checkpoint/base.py | 6 +++--- langgraph/pregel/__init__.py | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/langgraph/channels/base.py b/langgraph/channels/base.py index 9dc5fcbbc..77f49bacb 100644 --- a/langgraph/channels/base.py +++ b/langgraph/channels/base.py @@ -128,7 +128,7 @@ def create_checkpoint( channel_values=values, channel_versions=checkpoint["channel_versions"], versions_seen=checkpoint["versions_seen"], - pending_packets=checkpoint["pending_packets"], + pending_sends=checkpoint["pending_sends"], ) diff --git a/langgraph/checkpoint/base.py b/langgraph/checkpoint/base.py index 19d550af0..bf87fa82c 100644 --- a/langgraph/checkpoint/base.py +++ b/langgraph/checkpoint/base.py @@ -74,7 +74,7 @@ class Checkpoint(TypedDict): Used to determine which nodes to execute next. """ - pending_packets: List[Send] + pending_sends: List[Send] """List of packets sent to nodes but not yet processed. Cleared by the next checkpoint.""" @@ -91,7 +91,7 @@ def empty_checkpoint() -> Checkpoint: channel_values={}, channel_versions=defaultdict(int), versions_seen=defaultdict(_seen_dict), - pending_packets=[], + pending_sends=[], ) @@ -106,7 +106,7 @@ def copy_checkpoint(checkpoint: Checkpoint) -> Checkpoint: _seen_dict, {k: defaultdict(int, v) for k, v in checkpoint["versions_seen"].items()}, ), - pending_packets=checkpoint["pending_packets"].copy(), + pending_sends=checkpoint["pending_sends"].copy(), ) diff --git a/langgraph/pregel/__init__.py b/langgraph/pregel/__init__.py index 2c6f7a306..2de429ec3 100644 --- a/langgraph/pregel/__init__.py +++ b/langgraph/pregel/__init__.py @@ -1548,14 +1548,14 @@ def _apply_writes( channels: Mapping[str, BaseChannel], pending_writes: Sequence[tuple[str, Any]], ) -> None: - if checkpoint["pending_packets"]: - checkpoint["pending_packets"].clear() + if checkpoint["pending_sends"]: + checkpoint["pending_sends"].clear() pending_writes_by_channel: dict[str, list[Any]] = defaultdict(list) # Group writes by channel for chan, val in pending_writes: if chan == TASKS: - checkpoint["pending_packets"].append(val) + checkpoint["pending_sends"].append(val) else: pending_writes_by_channel[chan].append(val) @@ -1625,7 +1625,7 @@ def _prepare_next_tasks( checkpoint = copy_checkpoint(checkpoint) tasks: Union[list[PregelTaskDescription], list[PregelExecutableTask]] = [] # Consume pending packets - for packet in checkpoint["pending_packets"]: + for packet in checkpoint["pending_sends"]: if for_execution: if node := processes[packet.node].get_node(): writes = deque() @@ -1668,7 +1668,7 @@ def _prepare_next_tasks( else: tasks.append(PregelTaskDescription(packet.node, packet.arg)) if for_execution: - checkpoint["pending_packets"].clear() + checkpoint["pending_sends"].clear() # Check if any processes should be run in next step # If so, prepare the values to be passed to them for name, proc in processes.items():