Object/Blob store capabilities
Maintainer thường phản hồi trong vòng 4 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Is your feature request related to a problem? Please describe.
It is common to hold a reference to some file/large object in state. This can be, for example:
- A PDF for RAG/ingestion
- An excel document that we're generating
- A large dataframe that was pulled from S3
The problem is that this can really crowd out the state, if we JSON serialize it. E>G> a large pdf could be mbs of base-64 data each time, and as state is currently saved in its entirety after every node execution, this can get even worse.
Describe the solution you'd like
A few ideas, still thinking through:
Push to the serialization layer
This is the current approach -- we actually do this for pandas dataframes. To do this effectively, the user would be a CachingObject data type and register serialization capabilities for it. Pydantic also could do this easily.
This would look something like this -- this is an immutable reference file (E.G. one that is passed in or generated externally). Note you'd have extra steps if you were generating a file.
@dataclass
class ReferenceCachingFile:
path: str
contents_hash: str = None
contents: Optional[str] = None
def get() -> str:
if self.contents is not None:
return self.contents
self.contents = self.load()
return self.contents
def load() -> str:
with open(path, "r") as f:
contents = f.read()
# TODO -- compute + verify hash, TBD how much verification we'd want
return contents
@serde.serialize.register(ReferenceCachingFile)
def serialize_reference_caching_file(value: ReferenceCachingFile):
return {"path" value.path, "contents_hash": value.contents_hash, serde.KEY: "reference_caching_file"}
@serde.deserializer.register("reference_caching_file")
def deserialize_myclass(value: dict, myclass_kwargs: dict = None, **kwargs) -> cls:
out = ReferenceCachingFile(**value)
out.contents = out.load()
This is just an illustration -- it's missing two things:
- Generic pluggability to load from anywhere
- Saving capability as well in the case of generating files
Some options:
- Have mixins for saveable/writable with the right functions
- Keep these as part of the framework -- then just have people implement their own with a few in plugins/subclas
Push to the persistence layer
I think there's room for a o9bject_store abstraction here. Just like we have a persister, we could also have a blob store. E.G.
app = Application()
.with_state_persister(...)
.with_object_store(FileSystemStore())
...
Then the user could specify some sort of CachingFile (for lack of a better name) like we had above:
T = TypeVar("ObjectType")
class CachingFile(abc.ABC):
contents: T
contents_hash: str
location_data: dict # URI? TBD what extra data we need...
@abc.abstractmethod
def to_bytes() -> bytes:
...
@abc.abstractmethod
def from_bytes() -> T:
...
The blob store would then interact with this -- calling to_bytes/from_bytes and comparing the hash/saving at the hash location. Then the user can implement a CachingFile or use one of the plugins (pandas, pdf, etc...)... THe db would store the serialized/deserialized version, and then delegate to the blob store when rehydrating or saving state.
Some other things to flesh out:
- How to ensure we don't save it twice (the hash -- will need to put this in the interface...)
- When it would be loaded. Dynamically? On startup? Configurable?
Describe alternatives you've considered
The first one above is easiest to do now -- this is how it works, and we do something similar for pandas, a bit messy though.
Additional context
Milan J came to office hours today asking about this, thanks!
- Ngôn ngữ chính
- Python
- Star
- 2.6k
- Fork
- 208
- Merge trung bình
- 8 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 26
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/burr
-
Notebook UI launcher should use the current Python interpreterCó thể đã có người làm @sivakumar-mahalingam đã nhận 7 ngày trước. Đang mởstatus/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 4 ngày
-
astep() passes unprocessed inputs to pre_run_step hooksCó thể đã có người làm @sivakumar-mahalingam đã nhận 7 ngày trước. Đang mởstatus/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 4 ngày
-
`burr` fails to start when the Python path has a space in itCó thể đã có người làm @enekoreto đã nhận 10 ngày trước. Đang mởstatus/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Add more instructions for applying ORM migrations for S3 deploymentCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởarea/storage area/ui help wanted kind/documentation priority/low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/burr#524 · 11 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Add documentation on how to run the Burr UI serverCó thể đã có người làm @iamSerafinnn đã nhận 139 ngày trước. Đang mởarea/ui good first issue kind/documentation priority/low
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 68/100
apache/burr#272 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
Issue tương tự
-
intake mcp-intake needs-ac needs-human-review priority:medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Ikalus1988/MisakaNet#3848 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
521xueweihan/HelloGitHub#4105 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
igormcsouza/bookloud#54 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
aws-samples/sample-per-model-bedrock#526 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ok-oldking/ok-wuthering-waves#1802 ·
Maintainer thường phản hồi trong vòng 2 ngày