Rename checkpoint var

This commit is contained in:
Nuno Campos
2024-05-31 15:18:56 -07:00
parent 5b5323b94f
commit a436e14fad
3 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -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"],
)
+3 -3
View File
@@ -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(),
)
+5 -5
View File
@@ -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():