<#1320 fix: route Dir.download_sync through obstor...
# flyte-github
a
#1320 fix: route Dir.download_sync through obstore-aware storage.get Pull request opened by cosmicBboy Summary Fixes ENG26-937. Reading a
Dir
input from a sync task via
Dir.download_sync()
failed with
Object at location <dir-uri> not found
, even though the directory and its files exist in object storage. The async equivalent,
await Dir.download()
, on the same
Dir
worked. Root cause
Dir.download_sync()
bypassed the SDK's obstore-aware
storage.get()
and called the raw fsspec
fs.get(self.path, local_dest, recursive=True)
. For obstore-backed filesystems (S3/GCS/ABFS), the obstore backend resolves
recursive=True
on a directory prefix as a single-object GET on that prefix, which 404s. The async
Dir.download()
didn't hit this because it routes through
storage.get()
, which detects obstore protocols and lists + downloads the prefix contents. Fix
download_sync
now mirrors the async path, running the obstore-aware
storage.get()
synchronously via the existing
syncify
bridge: return syncify(storage.get)(self.path, local_dest, recursive=True) The local-filesystem and
local_path is None
branches are unchanged. Tests Added two
@pytest.mark.sandbox
regression tests in `tests/flyte/io_types/test_dirs.py`: •
test_download_dir_sync
— downloads an S3 dir to a target path, asserting nested subdirectory contents arrive. •
test_download_dir_sync_no_local_target
— downloads without a target path. Both were verified to fail with the original
FileNotFoundError
when the fix is reverted and pass with it (run against a local minio S3 backend). Reproduction example Added
examples/basics/dir_download_sync_repro.py
, which builds a multi-file
Dir
(with a nested subdirectory) in an async task and downloads it from a sync task via
download_sync()
— the exact scenario from the issue. It only manifests the bug against real object storage; the docstring notes it must be run against a remote storage config. Test plan •
test_download_dir_sync
/
test_download_dir_sync_no_local_target
fail without the fix, pass with it (minio S3) • Full non-integration io_types suite passes (54 tests) • Reproduction example fails without the fix, succeeds with it • ruff + mypy clean 🤖 Generated with Claude Code flyteorg/flyte-sdk