Skip to content

Commit

Permalink
Updates base persister load docs
Browse files Browse the repository at this point in the history
So that they describe the expected behavior better.
  • Loading branch information
skrawcz committed Aug 31, 2024
1 parent 32faa7b commit aee53af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
7 changes: 4 additions & 3 deletions burr/core/persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ def load(
:param partition_key: the partition key. Note this could be None, but it's up to the persistor to whether
that is a valid value it can handle.
:param app_id: the identifier for the app instance being recorded.
:param sequence_id: optional, the state corresponding to a specific point in time.
If not provided, should return the latest.
:return: position, state, sequence_id
:param sequence_id: optional, the state corresponding to a specific point in time. Specifically state at the
end of the action with this sequence_id. If sequence_id is not provided, persistor should return the state
from the latest fully completed action.
:return: PersistedStateData or None
"""
pass

Expand Down
18 changes: 9 additions & 9 deletions burr/tracking/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,15 +621,15 @@ def load(
for key in to_delete:
del prior_state[key]
prior_state["__SEQUENCE_ID"] = sequence_id # add the sequence id back
return {
"partition_key": partition_key,
"app_id": app_id,
"sequence_id": sequence_id,
"position": position,
"state": State.deserialize(prior_state, **self.serde_kwargs),
"created_at": datetime.datetime.fromtimestamp(os.path.getctime(path)).isoformat(),
"status": "completed" if line["exception"] is None else "failed",
}
return PersistedStateData(
partition_key=partition_key,
app_id=app_id,
sequence_id=sequence_id,
position=position,
state=State.deserialize(prior_state, **self.serde_kwargs),
created_at=datetime.datetime.fromtimestamp(os.path.getctime(path)).isoformat(),
status="completed" if line["exception"] is None else "failed",
)


# TODO -- implement async version
Expand Down

0 comments on commit aee53af

Please sign in to comment.