cnvrg 1.10.20 → 1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 443373b68531083498c571cacf504da4dc02d005ef5c749a0077b7a4efce49ac
4
- data.tar.gz: 6b944be355bd91eccc138792fbcf117dc4fdb8b505b75a7b888dcd74f47aa1ed
3
+ metadata.gz: 04a9acd0283e8ef3c4aacfa23c90d2954e3e0a2ad4f2a70eed66ea0b87144956
4
+ data.tar.gz: 8221939940f215d62f6c5a66705cbdd20f6218c87007d2f71d9a4fdba0af5285
5
5
  SHA512:
6
- metadata.gz: b7ff78d2eceb2a420f46d2ed96ac06ab2c96cc031d8949581069f2b4a4c9d45f210120024c2c25fe93b4542c9f0de0d3dcf893745911f129b8986cda716d3505
7
- data.tar.gz: 56d85bf1fb4d16c1ec3ce46dfd5e38363c71a5242daaddb6e7f8cfa335526961abf4c6cf2345426fd8689d97e7d9a4e03b75c34e16ca32d440aca42459ed07e3
6
+ metadata.gz: 286544fb7129aef8fa679aa3daacdfa983cc10154709ceadbaf58406676780225559702b41195182156a379e0f4c6bc192d067eb39a7476a605bd9381f504597
7
+ data.tar.gz: '09e9a6a66e91b29afd2940b02d424785556cce005d1b966e7f3e82c6eb448014d6c8657570c4305274fae7b1d34f824520f6e12a90688f069dfaa8facad5d1b8'
@@ -52,7 +52,7 @@ module Cnvrg
52
52
  end
53
53
  raise SignalException.new(1, "Cant find file #{file}") unless File.exists? "#{Dir.pwd}/#{file}"
54
54
  end
55
- paths.map{|p| p.gsub(/^\.\//, '')}
55
+ paths
56
56
  end
57
57
 
58
58
  def get_files_and_folders(paths)
@@ -429,9 +429,10 @@ module Cnvrg
429
429
 
430
430
  file_chunks = files.each_slice(chunk_size).to_a
431
431
  # Fetch the required files from the server:
432
- Parallel.map((file_chunks), in_threads: 10) do |files_chunk|
432
+ Parallel.map((file_chunks), in_threads: threads) do |chunk|
433
+ files_chunk = chunk.map{|p| p.gsub(/^\.\//, '')}
433
434
  Cnvrg::Logger.info("Generating chunk idx")
434
- tree = @dataset.generate_chunked_idx(files_chunk, prefix: prefix, threads: threads)
435
+ tree = @dataset.generate_chunked_idx(files_chunk, prefix: prefix, threads: threads, cli: cli)
435
436
  Cnvrg::Logger.info("Getting files info from server")
436
437
  results = request_upload_files(commit_sha1, tree, override, new_branch, partial_commit)
437
438
  next unless results
@@ -1199,7 +1200,9 @@ module Cnvrg
1199
1200
  end
1200
1201
 
1201
1202
  def end_commit(commit_sha1, force, success: true, uploaded_files: 0, commit_type: nil)
1203
+ counter = 0
1202
1204
  begin
1205
+ counter += 1
1203
1206
  response = Cnvrg::API.request(
1204
1207
  "#{base_resource}/commit/end",
1205
1208
  'POST',
@@ -1211,9 +1214,11 @@ module Cnvrg
1211
1214
  commit_type: commit_type
1212
1215
  }
1213
1216
  )
1214
- Cnvrg::CLI.is_response_success(response, true)
1217
+ is_success = Cnvrg::CLI.is_response_success(response, false)
1218
+ raise Exception.new("Invalid response #{response}") unless is_success
1215
1219
  return response
1216
1220
  rescue => e
1221
+ retry if counter <= 20
1217
1222
  return false
1218
1223
  end
1219
1224
  end
@@ -541,7 +541,7 @@ module Cnvrg
541
541
  "#{url}/#{self.owner}/datasets/#{self.slug}"
542
542
  end
543
543
 
544
- def generate_chunked_idx(list_files = [], threads: 15, prefix: '')
544
+ def generate_chunked_idx(list_files = [], threads: 15, prefix: '', cli: nil)
545
545
  tree = {}
546
546
  Parallel.map(list_files, in_threads: threads) do |file|
547
547
 
@@ -552,7 +552,11 @@ module Cnvrg
552
552
  label = safe_path.gsub(self.local_path + "/", "")
553
553
  label = "#{prefix}/#{label}" if prefix.present?
554
554
  if not Cnvrg::Files.valid_file_name?(label)
555
- raise StandardError.new("#{label} is not a valid file name.")
555
+ if cli
556
+ cli.log_message("#{label} is not a valid file name, skipping it", Thor::Shell::Color::RED)
557
+ else
558
+ puts "#{label} is not a valid file name, , skipping it"
559
+ end
556
560
  end
557
561
  if File.directory? file
558
562
  tree[label + "/"] = nil
@@ -14,8 +14,15 @@ module Cnvrg
14
14
  end
15
15
 
16
16
  def extract_key_iv(sts_path)
17
- sts = open(sts_path, {ssl_verify_mode: 0}).read rescue nil
18
- raise StandardError.new("Cant open sts") if sts.blank?
17
+ count = 20
18
+ begin
19
+ count += 1
20
+ sts = open(sts_path, {ssl_verify_mode: 0}).read rescue nil
21
+ rescue => e
22
+ Cnvrg::Logger.log_error(e)
23
+ retry if count <= 20
24
+ raise StandardError.new("Cant access storage: #{e.message}")
25
+ end
19
26
  sts.split("\n")
20
27
  end
21
28
 
@@ -1,3 +1,3 @@
1
1
  module Cnvrg
2
- VERSION = '1.10.20'
2
+ VERSION = '1.11'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cnvrg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.20
4
+ version: '1.11'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yochay Ettun
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-09-22 00:00:00.000000000 Z
13
+ date: 2020-09-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -453,7 +453,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
453
453
  - !ruby/object:Gem::Version
454
454
  version: '0'
455
455
  requirements: []
456
- rubygems_version: 3.1.2
456
+ rubygems_version: 3.0.4
457
457
  signing_key:
458
458
  specification_version: 4
459
459
  summary: A CLI tool for interacting with cnvrg.io.