Merge pull request #2087 from langchain-ai/nc/11oct/o-flag

fix: Work w python's O flag
This commit is contained in:
Nuno Campos
2024-10-11 12:03:21 -07:00
committed by GitHub
2 changed files with 9 additions and 6 deletions
+6 -4
View File
@@ -866,9 +866,10 @@ class Pregel(Runnable[Union[dict[str, Any], Any], Union[dict[str, Any], Any]]):
if saved:
checkpointer.put_writes(checkpoint_config, task.writes, task_id)
# apply to checkpoint and save
assert not apply_writes(
mv_writes = apply_writes(
checkpoint, channels, [task], checkpointer.get_next_version
), "Can't write to SharedValues from update_state"
)
assert not mv_writes, "Can't write to SharedValues from update_state"
checkpoint = create_checkpoint(checkpoint, channels, step + 1)
next_config = checkpointer.put(
checkpoint_config,
@@ -1011,9 +1012,10 @@ class Pregel(Runnable[Union[dict[str, Any], Any], Union[dict[str, Any], Any]]):
if saved:
await checkpointer.aput_writes(checkpoint_config, writes, task_id)
# apply to checkpoint and save
assert not apply_writes(
mv_writes = apply_writes(
checkpoint, channels, [task], checkpointer.get_next_version
), "Can't write to SharedValues from update_state"
)
assert not mv_writes, "Can't write to SharedValues from update_state"
checkpoint = create_checkpoint(checkpoint, channels, step + 1)
next_config = await checkpointer.aput(
checkpoint_config,
+3 -2
View File
@@ -503,12 +503,13 @@ class PregelLoop:
manager=None,
)
# apply input writes
assert not apply_writes(
mv_writes = apply_writes(
self.checkpoint,
self.channels,
[*discard_tasks.values(), PregelTaskWrites(INPUT, input_writes, [])],
self.checkpointer_get_next_version,
), "Can't write to SharedValues in graph input"
)
assert not mv_writes, "Can't write to SharedValues in graph input"
# save input checkpoint
self._put_checkpoint({"source": "input", "writes": dict(input_writes)})
elif CONFIG_KEY_RESUMING not in configurable: