The Batch Module in the AIStore Python SDK allows you to load multiple objects in a single request. Instead of multiple individual GET requests, AIStore aggregates the requested objects (or sharded files) into a single ordered archive (e.g., TAR, ZIP) and streams it back. This reduces network round-trips and connection overhead, which is particularly beneficial for high-performance ML training workloads.
Key features include:
- Multi-Bucket Support: A single batch can span multiple local or remote cloud buckets (S3, GCS, Azure, OCI).
- Strict Ordering: The archive contains objects in the exact sequence they were requested.
- Archive Path Support: You can extract specific files from within archive objects (like WebDataset) without downloading the entire archive.
- Byte Range Reads: Request specific byte ranges from objects or extracted archive files.
from aistore.sdk import Client
client = Client("http://localhost:8080")
bucket = client.bucket("example")
# Batch get using object names as strings
object_names = ["obj1", "obj2", "dir/file3.jpg"]
batch = client.batch(object_names, bucket=bucket)
for obj_info, data in batch.get():
print(f"Object: {obj_info.obj_name}, Size: {len(data)}")