-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download Images asynchronously in Image Processing #445
Conversation
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
See comment.
This isn't a perfect solution due to the difficulty of requiring pre-signed URLs.
Is having a private S3 bucket an integral part of the DroneTM platform? It adds significant complications (we can't have NodeODM simply download the files itself - best case we have to relay via our API for presigned URLs)
|
||
# generate pre-signed URL for each object | ||
object_urls = [ | ||
get_presigned_url(bucket_name, obj.object_name, 12) for obj in objects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks great, except this is synchronous and may cause a bottleneck.
How did this perform during testing?
Any speed or memory issues as previously?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Downloading looks good with this implementation.
Also, the images are public in S3. So, instead of using presigned url, we can directly use download urls.
I will update this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! That makes things much easier and reduces the number of requests by half 😁
You can probably list all the image file names with one S3 call, then pass through the list of constructed URLs to the async downloader
Do we need presigned URLs for the downloads @nrjadkry ? It will significantly slow down the download process. Can't we just construct the URL ourselves and download directly from the public bucket? The purpose of pre signing is:
|
I have kept the presigned urls in case the bucket is private.
|
Oooh thanks for that snippet - missed it reviewing on my phone! Makes sense, thanks 😁 |
@spwoodcock |
So sorry @nrjadkry, its going to be a good few days until I can look at this. It needs some dedicated time to work out. I believe I had some ideas / possible solutions in threads here somewhere though. OAM had a second issue today & I'm so far behind with FMTM 😅 Ping me if I forget please! 🙏 |
Enhance Asynchronous S3 Image Downloading
DroneImageProcessor
to support efficient async image downloadsasyncio
andaiohttp
Changes include:
download_images_from_s3
method to support async downloads@spwoodcock
One question I would like to ask you is if we can support more than 10 parallel uploads. There is an option for parallel uploads in ODM. By default, it is 10 parallel downloads.