Method: Cnvrg::Datafiles#download_files_chunk

Defined in:
lib/cnvrg/datafiles.rb

#download_files_chunk(files, conflict: false, progress: nil) ⇒ Object



1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
# File 'lib/cnvrg/datafiles.rb', line 1331

def download_files_chunk(files, conflict: false, progress: nil)
  (1..5).each do |i|
    response = Cnvrg::API.request("users/#{@owner}/datasets/#{@dataset_slug}/download_multi", 'POST', {files: files})
    next unless Cnvrg::CLI.is_response_success(response, false) #trying to api request 5 times.
    files_to_download = response['files']
    data_home = "#{Dir.pwd}/#{response['name']}"
    res = download_multiple_files_s3(files_to_download, data_home, conflict: conflict, read_only: false, progressbar: progress)
    next unless res.is_success? #try again..
    return files_to_download['keys'].length
  end
end