vignesh-manel opened a new pull request, #931:
URL: https://github.com/apache/burr/pull/931
Adds an optional object/blob storage abstraction for large values (files,
images, dataframes, etc...) that shouldn't be embedded directly in
`State`. Today, State is fully re-serialized to the persister/tracker
after every action, so putting a large binary blob in state means it
gets re-written on every subsequent step even when it never changes.
This implements the "push to the persistence layer" approach discussed
in #467 -- a store for the bytes, and a small content-addressed
reference kept in state instead.
## Changes
- add `burr.core.artifacts` with `ArtifactStore` (abstract `put`/`get`/
`exists`, with `put_artifact`/`get_artifact` provided for free to
handle digest computation/verification and content-addressed keys),
`ArtifactRef` (frozen, content-addressed reference), and
`LocalFileSystemArtifactStore` (stdlib-only, local disk backend)
- add `burr.integrations.artifacts.s3.S3ArtifactStore`, gated behind
a new optional `s3` extra (`pip install "apache-burr[s3]"`)
- register `ArtifactRef` with `burr.core.serde` so it serializes /
deserializes automatically as part of normal `State` handling --
deserializing a ref never eagerly re-fetches the underlying bytes
- add `ApplicationBuilder.with_object_store(...)`, threaded through
`Application`/`ApplicationContext` so actions can access the
configured store via `__context.object_store` without constructing
or importing their own
- this does not register a lifecycle hook -- Burr never reads or
writes to the store on its own, actions call `put_artifact`/
`get_artifact` explicitly
- add docs: `docs/concepts/artifact-storage.rst` (conceptual overview
+ usage) and `docs/reference/artifacts.rst` /
`docs/reference/integrations/s3.rst` (API reference)
## How I tested this
- `python -m pytest tests/core/test_artifacts.py
tests/integrations/artifacts/test_s3.py tests/core/test_application.py
tests/core/test_parallelism.py -q`
- S3 tests use `botocore.stub.Stubber` -- no live AWS account or network
access required
- `pre-commit run --all-files`
## Notes
- `with_object_store` is purely a way to configure and share a store
(e.g. local disk in dev, S3 in prod) across actions -- it's not a
replacement for `with_state_persister`, which handles the state
machine's own bookkeeping.
- Custom backends only need to implement `put`/`get`/`exists`;
digest computation/verification is provided by the base class.
## Checklist
- [x] PR has an informative and human-readable title (this will be pulled
into the release notes)
- [x] Changes are limited to a single goal (no scope creep)
- [x] Code passed the pre-commit check & code is left cleaner/nicer than
when first encountered.
- [x] Any _change_ in functionality is tested
- [x] New functions are documented (with a description, list of inputs, and
expected output)
- [x] Placeholder code is flagged / future TODOs are captured in comments
- [x] Project documentation has been updated if adding/changing
functionality.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]