nvflare.fuel.f3.streaming.obj_downloader module
- class ObjectDownloader(cell: Cell, timeout: float, num_receivers: int, tx_id=None, transaction_done_cb=None, **cb_kwargs)[source]
Bases:
objectDefines a universal object downloader that can be used to download any Downloadable objects.
Constructor of ObjectDownloader.
- Parameters:
cell – the communication cell.
timeout – timeout of the transaction
num_receivers – number of sites to download the objects to. 0 means unknown.
tx_id – if specified, this will be used as the ID of the new transaction. If not specified, dynamically generates the transaction id.
transaction_done_cb – the callback to be called when the transaction is done.
**cb_kwargs – kwargs to be passed to transaction_done_cb.
Notes: the CB signature is:
transaction_done_cb(tx_id, status, objects: list, **cb_kwargs)
where tx_id is the ID of the transaction; status is a value as defined in TransactionDoneStatus; objects is a list of base objects to be downloaded. Note that the base object is not the Downloadable object! For example, in case of file downloading, the Downloadable object is FileDownloadable, whereas the base object is the name of the file.
Downloadable object is only needed to work with the Downloader, and not useful for apps.
- add_object(obj: Downloadable, ref_id=None) str[source]
Add a Downloadable object to the downloader.
- Parameters:
obj – the Downloadable object to be added.
ref_id – if specified, use it as the generated ref. If not specified, dynamically generates a ref ID.
Returns: the ref ID for the object.