It seems you can simply specify the chunk_size parameter when calling job.download_to_file as follows:
if job.completed: print "Downloading archive" job.download_to_file(OUTPUT, chunk_size=1024*1024)
However, if you canβt download all the pieces within 24 hours, I donβt think you can only download the one that you skipped using layer2.
First method
Using layer1, you can simply use the get_job_output method and specify the range of bytes you want to load.
It will look like this:
file_size = check_file_size(OUTPUT) if job.completed: print "Downloading archive" with open(OUTPUT, 'wb') as output_file: i = 0 while True: response = gv.get_job_output(VAULT_NAME, job_id, (file_size + 1024 * 1024 * i, file_size + 1024 * 1024 * (i + 1))) output_file.write(response) if len(response) < 1024 * 1024: break i += 1
With this script, you can restart the script when it does not work, and continue loading your archive where you left it.
Second method
Delving into the boto code, I found the "private" method in the Job class, which you can also use: _ download_byte_range . With this method, you can still use layer2.
file_size = check_file_size(OUTPUT) if job.completed: print "Downloading archive" with open(OUTPUT, 'wb') as output_file: i = 0 while True: response = job._download_byte_range(file_size + 1024 * 1024 * i, file_size + 1024 * 1024 * (i + 1))) output_file.write(response) if len(response) < 1024 * 1024: break i += 1
source share