Summary
Multiple concerns about the CheckpointStorage protocol including return types, querying capabilities, and behavior when multiple workflow instances write to the same storage.
Files
| File |
Line |
Concern |
_checkpoint.py |
list_checkpoint_ids |
Return type should use type alias, IDs may not be consistent |
_checkpoint.py |
list_checkpoints |
Improve API: add .get_latest(), better error handling |
_checkpoint.py |
after delete_checkpoint |
Parallel workflow instances writing to same storage |
Context
Return Type Consistency:
# TODO: change the return type (via type alias) can be str from functional perpective
# Concrete type
# IDs may not be consitent (str -> tuple[str, str]) or something
# checkpoint_ids (not list)
async def list_checkpoint_ids(self, workflow_id: str | None = None) -> list[CheckpointId]:
The CheckpointId type may evolve (e.g., from str to tuple[str, str]). Need a type alias to insulate users from changes.
API Improvements:
# TODO: improve this API .get_latest(), error, human in the list
# allow users to specify a workflow_id when building?
# workflow_id should be an opaque type
async def list_checkpoints(self, workflow_id: str | None = None) -> list[WorkflowCheckpoint]:
Common use case of "get the latest checkpoint" is not well-supported. Also, workflow_id should be an opaque type.
Multi-Instance Safety:
# TODO: when running two workflow instances in parallel, we could be writing to
# the same storage. How do we know if we are referencing the right checkpoints?
No isolation between concurrent workflow instances sharing the same storage.
Action Items
Summary
Multiple concerns about the
CheckpointStorageprotocol including return types, querying capabilities, and behavior when multiple workflow instances write to the same storage.Files
_checkpoint.pylist_checkpoint_ids_checkpoint.pylist_checkpoints.get_latest(), better error handling_checkpoint.pydelete_checkpointContext
Return Type Consistency:
The
CheckpointIdtype may evolve (e.g., fromstrtotuple[str, str]). Need a type alias to insulate users from changes.API Improvements:
Common use case of "get the latest checkpoint" is not well-supported. Also,
workflow_idshould be an opaque type.Multi-Instance Safety:
No isolation between concurrent workflow instances sharing the same storage.
Action Items
CheckpointIdtype alias that can evolve without breaking changesget_latest_checkpoint(workflow_id)convenience methodworkflow_idan opaque typeworkflow.run()