Move async options out of trolley into searcher
Closed this issue · 0 comments
sjoerdk commented
- dicomtrolley version: 2.0
Description
Currently Trolley.download() has options use_async
and max_workers
. In addition, The Downloader
base class has a method datasets_async().
Async might be nice for some searchers but not for all. The options and extra required functions that Downloader
child classes have to implement the class method signature are cluttering up the trolley interface. This functionality should not be required, and instead be left up to individual downloaders.
- Remove async parameters and methods from
Trolley
andDownloader
classes. Move async functionality intoDownloader
child classes if needed. Trolley init is much clearer that way:
Before:
searcher=Mint(session, "https://server/mint")
downloader=Wado(session, "https://server/wado")
trolley = Trolley(searcher, downloader)
trolley.download(target, use_async=True, max_workers=4)
# You have to pass use_async and max_workers for each download (annoying)
# You can switch between async and non-async easily (why would you want that?)
After:
searcher=Mint(session, "https://server/mint")
downloader=Wado(session, "https://server/wado", use_async=True, max_workers=4)
trolley = Trolley(searcher, downloader)
trolley.download(target) # makes more sense, trolley interface is cleaner. You configure async once