Method: Cnvrg::Datafiles#upload_data_log_file

Defined in:
lib/cnvrg/datafiles.rb

#upload_data_log_file(absolute_path, relative_path, data_commit_sha) ⇒ Object



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/cnvrg/datafiles.rb', line 254

def upload_data_log_file(absolute_path, relative_path,data_commit_sha)
  file_name = File.basename relative_path
  file_size = File.size(absolute_path).to_f
  content_type = "text/x-log"
  upload_resp = Cnvrg::API.request("/users/#{@owner}/" + "upload_data_log", 'POST_FILE', {absolute_path: absolute_path, relative_path: relative_path,
                                                                                         file_name: file_name, log_date: Time.now,
                                                                                         file_size: file_size, file_content_type: content_type,
                                                                                          data_commit_sha1:data_commit_sha})
  if Cnvrg::CLI.is_response_success(upload_resp, false)
    path = upload_resp["result"]["path"]
    s3_res = upload_small_files_s3(path, absolute_path, "text/plain")
  end
  if s3_res
    return true
  end
  return false

end