roboto.fs.download_session#

Module Contents#

class roboto.fs.download_session.DownloadSession(items, association, roboto_client=None, caller_org_id=None)#

Manages a batch of file downloads with shared credentials.

Provides credential lifecycle management and async operation coordination for downloading files from a dataset. Unlike UploadTransaction, this does not manage an API transaction since downloads don’t require server-side state tracking.

Example

>>> session = DownloadSession(
...     items=[
...         {"bucket_name": "bucket", "source_uri": "s3://bucket/key", "destination_path": Path("/tmp/file")}
...     ],
...     association=Association.dataset("ds_123"),
... )
>>> object_store = registry.get_store_for_uri(uri, session.credential_provider)
>>> with object_store:
...     for file in session:
...         future = object_store.get(file["source_uri"], file["destination_path"])
...         session.register_download(file, future)
Parameters:
await_downloads()#

Wait for all registered downloads to complete.

Must be called while still inside the object_store context manager, since the transfer manager may be shut down when that context exits.

Raises:

ExceptionGroup – If any downloads fail, an ExceptionGroup containing all download errors is raised.

Return type:

None

make_credential_provider(bucket_name=None)#

Return a credential provider for read-only access to the dataset.

Parameters:

bucket_name (Optional[str])

Return type:

roboto.fs.object_store.CredentialProvider

register_download(file, future)#

Register a pending download future.

Call this immediately after initiating each download transfer. The future will be awaited when await_downloads() is called.

Parameters:
Return type:

None

class roboto.fs.download_session.DownloadableFile#

Bases: TypedDict

A file to be downloaded from the Roboto Platform.

bucket_name: str#

Name of the bucket where the file is stored.

destination_path: pathlib.Path#

Local path where the file should be saved.

source_uri: str#

//bucket/key’).

Type:

Full URI of the file in cloud storage (e.g., ‘s3

roboto.fs.download_session.logger#