Skip to content

armgit / burr

Public Imported from GitHub
0

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.

Updates base persister load docs

Stefan Krawczykf63c94926e99
diff --git a/burr/core/persistence.py b/burr/core/persistence.py
index 287d861f..22c26174 100644
--- a/burr/core/persistence.py
+++ b/burr/core/persistence.py
@@ -32,9 +32,10 @@ class BaseStateLoader(abc.ABC):
: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
diff --git a/burr/tracking/client.py b/burr/tracking/client.py
index 001eba5e..f9070e18 100644
--- a/burr/tracking/client.py
+++ b/burr/tracking/client.py
@@ -621,15 +621,15 @@ class LocalTrackingClient(
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