Skip to main content

straw

中文版

Filesystem-based durable queues and shared tensor storage for AI applications.

straw uses a shared filesystem as its storage layer: workers on multiple machines read and write packed data through the same mounted filesystem and exchange small references. Storage and queue protocols run in Rust; Python APIs accept bytes, NumPy arrays and PyTorch tensors.

The current implementation and multi-machine validation focus on JuiceFS shared mounts, accessed through Linux/POSIX filesystem operations. Local filesystems are also used for development and single-machine tests. Support for additional network filesystems, including NFS deployments, is planned; each needs validation of its locking, visibility and durability semantics.

straw currently serves the rollout and training pipelines in slime, including rollout-to-rollout and rollout-to-training queues that share tensor storage. It is an independent AI application library, also suited to preprocessing and inference pipelines. See the design rationale and application integration.

Multi-machine parallel reads and writes

Multiple producers append concurrently to their own packs; readers on other machines access committed immutable extents by reference. The protocol makes payloads durable before publishing references, journals task ownership, accepted results and consumer progress, and coordinates shared ownership and GC through cross-client catalog locks. Reader pins and explicit completion signals protect data until every consumer has finished. See the concurrency rules and protocol.

Avoid the small-file bottleneck

Creating a file for every sample or tensor puts pressure on shared-filesystem metadata operations, especially on NFS. straw packs many records and their manifests into large append-only files, batches publication, and uses fixed append logs for queue metadata. There is no file per sample or tensor. File counts grow with packs and writer lifetimes instead of individual samples; packing and GC control their lifecycle.

Status: early release, Linux/POSIX. One externally fenced coordinator per queue; no automatic leader election or journal/live-pack compaction. Applications must provide real reader-completion signals before reclamation. See filesystem requirements and protocol guarantees.

Install

Install from PyPI:

pip install straw-queue

pip selects a compatible wheel containing the Rust extension. Installing a wheel does not require Rust or maturin. NumPy and PyTorch are runtime dependencies; an existing compatible PyTorch installation can be reused. Distribution name: straw-queue; import: straw. See supported platforms, offline installation and source builds.

Write, read, keep, reclaim

This complete example uses a private temporary directory. Use a new directory on your shared mount for a real job, with the same run ID on every client.

from tempfile import TemporaryDirectory
from straw import Record, SharedFilesystemStore

with TemporaryDirectory() as root:
    with SharedFilesystemStore(root, "example", online_gc=True) as store:
        ref = store.publish([Record("message", b"hello")], submission_id="write-1")
        store.retain("application:checkpoint-1", [ref])
        store.release_publications([ref])  # The checkpoint now owns this data.
        assert next(store.read(ref)).payload == b"hello"

        store.seal()  # Stop appending to this pack before it can be collected.
        assert store.collect_garbage()["reclaimed_files"] == 0
        store.release("application:checkpoint-1")
        assert store.collect_garbage()["reclaimed_files"] == 1

A returned reference is an address, not a permanent lifetime guarantee. Publication staging initially protects it. A queue, checkpoint, explicit owner or reader pin must protect it while it is in use. Garbage collection removes only sealed packs with no remaining owners; closing a writer does not release application ownership. See data and lifetime APIs.

What can I store?

Data Write Read
Opaque bytes, encoded text, JSON, images or application formats Record + store.publish store.read / read_record, then your decoder
NumPy arrays and PyTorch tensors publish_tensors TensorRef.load() or contiguous row slices
Several records or tensors forming one result publish / publish_many One RecordSetRef addresses the ordered records
Shared immutable data used by several queues Dependencies and TensorRef.share Each queue retains the same underlying packs
A changed tensor TensorRef.updated A new tensor; the original remains unchanged

straw never unpickles stored payloads. Codec names are explicit and versioned; applications own serialization of their custom objects. Tensor helpers copy device data to contiguous CPU storage and support checked row reads. They are not GPU IPC or page-level copy-on-write. Supported types and examples.

Applications may use multiple processes/machines or threads. straw exposes synchronous Rust-backed calls and does not start an I/O process pool itself. See concurrency and writer ownership.

Keep file counts bounded by packs

Reuse a store per writer process. Its default 1 GiB pack contains many publications, including their manifests. Queue metadata uses fixed append logs, and GC uses one shared catalog. There is no file per sample or tensor.

Rotate by bytes, batch small writes with publish_many, release consumed data, and seal idle writers. A pack containing even one live record remains retained. Repeated writer restarts, per-sample close()/seal(), or retaining every checkpoint can still grow storage; the target size is not a global quota. File-count and retention planning.

Run something small

After installing the wheel, examples from this source tree run directly:

python examples/records.py
python examples/tensors.py
python examples/work_queue.py
python examples/multiprocess.py --root /tmp/new-straw-recovery-run

Run a bounded local benchmark without SSH or GPUs:

python -m straw.benchmark run --local \
  --root /tmp/new-straw-benchmark --report benchmark-results/local.json \
  --gib 0.0625 --record-bytes 1048576 262144 \
  --segment-mib 8 --online-gc --max-files 64 --max-gib 0.25

The benchmark verifies reads, measures durable publication/acceptance latency, reports bytes and file counts, and removes its temporary payload root after workers stop. Multi-host benchmarks and trace replay.

The tests and wheels workflows provide CI checks and downloadable artifacts; version tags publish tested artifacts. See contributing for setup and release steps.

License

MIT.

straw-protocol-review skill: review document → TLA+ → implementation.

Metadata

Release files for straw-queue 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for straw-queue 0.1.5
File Size Uploaded Provenance Actions
straw_queue-0.1.5.tar.gz 601.7 kB With provenance Details for straw_queue-0.1.5.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for straw-queue 0.1.5
File Actions
straw_queue-0.1.5-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details for straw_queue-0.1.5-cp313-cp313-manylinux_2_28_x86_64.whl
straw_queue-0.1.5-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details for straw_queue-0.1.5-cp312-cp312-manylinux_2_28_x86_64.whl
straw_queue-0.1.5-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details for straw_queue-0.1.5-cp311-cp311-manylinux_2_28_x86_64.whl
straw_queue-0.1.5-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details for straw_queue-0.1.5-cp310-cp310-manylinux_2_28_x86_64.whl

Total release size: 4.1 MB

Release files / straw_queue-0.1.5.tar.gz

Download URL straw_queue-0.1.5.tar.gz
Size 601.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fe963a98655c2183037b64649d458cc705edf7ad3de9384c8d5c99d25f25b685
BLAKE2b-256 checksum
How to use checksums
51e8dcaee4582ff5a1e1256c0141b89bc853f8d893f3ce34aefde1fbcd0bddb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / straw_queue-0.1.5-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL straw_queue-0.1.5-cp313-cp313-manylinux_2_28_x86_64.whl
Size 883.6 kB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
51156ccbe2a1cd4938da55c75d0002c42f176616e74c614a6aee8d48b9e0198e
BLAKE2b-256 checksum
How to use checksums
10148c32b96fda98b2a547fe7d351b07671ea3271495bb3935cc64ca3f8a9127
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / straw_queue-0.1.5-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL straw_queue-0.1.5-cp312-cp312-manylinux_2_28_x86_64.whl
Size 884.4 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c97688d9097f4949807986f317e6ededfdd4a395fbdd7bf65ce2bd6c21121cb8
BLAKE2b-256 checksum
How to use checksums
5fe7c5687102f4c592a83365c94750154c0a9cd929c368300390773d81825928
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / straw_queue-0.1.5-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL straw_queue-0.1.5-cp311-cp311-manylinux_2_28_x86_64.whl
Size 883.2 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
99aab6577afc2e78934081101f8e9e9fb16e18d2a97d8f2fdda9404752b25669
BLAKE2b-256 checksum
How to use checksums
ad50d537af842305157422a2b6900e3ab8c9a185b18b0a99d3026a8dfb195e20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / straw_queue-0.1.5-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL straw_queue-0.1.5-cp310-cp310-manylinux_2_28_x86_64.whl
Size 883.3 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
107b7dfefebcaf1225bc02b71d62f98bb930f2109fa13047c55b888a5b4059e5
BLAKE2b-256 checksum
How to use checksums
32004d4f4898a1fbc4bc4d0615891745335463f1a959b67f23f2cf7792496d1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for straw-queue 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for straw_queue-0.1.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page