acoustic-carpenter-78188
06/08/2026, 2:10 AM.fastq.gz to GCS (Flyte v2) hit:
InvalidArgument: Part number, 10002, must be between 1 and 10000
Root cause — not a GCS or obstore bug. flyte.storage.put() delegated to fsspec → obstore-fsspec _put_file, which calls store.put_async(...) without a chunk_size, leaving it pinned to obstore's 5 MiB default. GCS and S3 both hard-cap multipart uploads at 10,000 parts, so 5 MiB × 10,000 = a silent ~48.8 GiB (~52 GB) upload ceiling. Any file above that fails at partNumber=10001+. (The reported "30 GB" file is larger than estimated — part 10002 ≈ a ~52 GB object at 5 MiB parts.)
The upload path exposed no way to raise the part size (downloads already have FLYTE_IO_CHUNK_SIZE / MAX_CONCURRENCY via `ObstoreParallelReader`; uploads had nothing).
Fix
Auto-scale the multipart part size from the file size so the part count always stays under the limit — fully automatic, no user-facing knob:
• _compute_upload_chunk_size(size) → max(5 MiB, ceil(size / 9000)).
• _put_obstore_bypass() calls obstore.put_async directly with the computed chunk_size (streams from a pathlib.Path, no full read into memory); handles single files and recursive directory uploads.
• put() routes obstore-protocol uploads (`s3`/`gs`/`abfs`/`abfss`) through the bypass, guarded identically to the existing download bypass; everything else falls back to fsspec unchanged.
Mirrors the existing download-side _get_obstore_bypass / ObstoreParallelReader pattern.
Behavior / perf
• Files ≤ ~45 GiB: identical 5 MiB parts → no change.
• Files > ~45 GiB: larger parts → fewer PUTs (these used to fail outright). A 1 TB file uses ~117 MiB parts and succeeds.
• Only added work per file is one os.path.getsize stat — negligible next to the upload.
• Recursive directory uploads keep the same concurrency (BATCH_SIZE) and per-file path as before.
Verification
• Confirmed the recursive bypass produces an identical destination key layout to fsspec's _put (contents directly under the prefix, no basename nesting) for both the async obstore backend and LocalFileSystem — so `DataFrame`/`Dir` round-trips are unaffected.
• New unit tests: chunk-size math (small → 5 MiB floor; 60 GiB → parts < 10,000), put routing through the bypass with auto-sized chunk_size, and recursive multi-file layout.
• tests/internal/storage/ — 58 passed (1 deselected = the LocalStack @pytest.mark.sandbox test, needs a running cluster). Lint + format clean.
🤖 Generated with Claude Code
flyteorg/flyte-sdkacoustic-carpenter-78188
06/08/2026, 4:20 AM