Method: Cnvrg::Datafiles#download_files_chunk

Defined in:
lib/cnvrg/datafiles.rb

#download_files_chunk(files, conflict: false) ⇒ Object



840
841
842
843
844
845
846
847
848
849
850
# File 'lib/cnvrg/datafiles.rb', line 840

def download_files_chunk(files, conflict: false)
  (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)
    next unless res.is_success? #try again..
    return files_to_download['keys'].length
  end
end