cnvrg 1.10.18 → 1.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8009827a102d9ea4bda3e07d95ad52a23fe7202b2670850952fb345acac7b906
4
- data.tar.gz: aa91b22c83120d50f0631945d06f4d878e1cea4d2f9d950f6e29fbba17305f21
3
+ metadata.gz: 70906f4870c9aa2b3457673212893d09e6b5f22e15a5dc4c3b0cc2115e74d8d9
4
+ data.tar.gz: ff9de0565cf2c81102c68a21154af1f97d843e65d51fc8eb69f3a490b64bb9a3
5
5
  SHA512:
6
- metadata.gz: 2159ce3f1e3b55390b599a72b80c1b6de559554380d5b294922ddd001cff2c944cf6614bb582f184c62be6299826f4a1860257a5426c6534a254ea195bb9910c
7
- data.tar.gz: ccb989d604602dbcfcee6f40725ae8a45875744f222b7aa717ddfe2760483361d03a16f6e016179acf82c0c493d9a3518a548d18dbb850a7cf0fc0b99aef0120
6
+ metadata.gz: d839249d813d8004c9d00553f81273e890d7beb3bfab4bb65b64453f459bd6e4c366c59b35cee2773716e2c26f6f5b30223937837e088fe964e98a60b242c6e3
7
+ data.tar.gz: f7cac4b24a2f7fc275e28dd03b2fad4b7374dd52c648dd84f36652d6e7bd61f24e834aa89b1f826ac39e7680aa7cbfc6ca1564bc3611fdfe53dfd650368d7319
@@ -964,10 +964,9 @@ module Cnvrg
964
964
  Cnvrg::CLI.is_response_success(response,true)
965
965
  dataset_name = response["results"]["name"]
966
966
  dataset_slug = response["results"]["slug"]
967
- dataset_home = Dir.pwd+"/"+dataset_slug
967
+ dataset_home = Dir.pwd + "/" + dataset_slug
968
968
  Dataset.stop_if_dataset_present(dataset_home, dataset_name) if soft
969
969
 
970
- # dataset_home = Dir.pwd
971
970
  if Dataset.blank_clone(owner, dataset_name, dataset_slug)
972
971
  dataset = Dataset.new(dataset_home)
973
972
  log_message("Cloning #{dataset_name}", Thor::Shell::Color::BLUE)
@@ -986,12 +985,13 @@ module Cnvrg
986
985
  begin
987
986
  log_message("Downloading files", Thor::Shell::Color::BLUE)
988
987
  Parallel.map((response["results"]["query_files"]), parallel_options) do |f|
989
- relative_path = f["fullpath"].gsub(/^#{dataset_home}/, "")
988
+ relative_path = f["fullpath"].gsub(/^#{dataset_home}/, "").gsub(/^#{slug}/, "")
990
989
  relative_path_dir = relative_path.split("/")
991
990
  file_name = relative_path_dir.pop()
992
991
  relative_path_dir = relative_path_dir.join("/")
993
992
  abs_path = dataset_home + "/" + relative_path_dir
994
993
  abs_path = dataset_home if flatten
994
+
995
995
  begin
996
996
  FileUtils.mkdir_p(abs_path) unless File.exist? (abs_path + "/" + file_name)
997
997
  rescue
@@ -1781,8 +1781,7 @@ module Cnvrg
1781
1781
  print_table(list)
1782
1782
  end
1783
1783
 
1784
- desc 'commits', 'List all commits for a specific Project'
1785
-
1784
+ desc 'commits', 'List all commits for a specific Project', :hide => true
1786
1785
  def list_commits()
1787
1786
  verify_logged_in(true)
1788
1787
  log_start(__method__, args, options)
@@ -1796,7 +1795,7 @@ module Cnvrg
1796
1795
  end
1797
1796
 
1798
1797
 
1799
- desc 'unlink', 'Unlink a project from current directory'
1798
+ desc 'unlink', 'Unlink a project from current directory', :hide => true
1800
1799
 
1801
1800
  def unlink
1802
1801
  verify_logged_in(false)
@@ -1906,7 +1905,7 @@ module Cnvrg
1906
1905
  log_message("Remove dir in order to clone #{project_name}", Thor::Shell::Color::RED)
1907
1906
  exit(1)
1908
1907
  end
1909
-
1908
+
1910
1909
  end
1911
1910
  clone_resp = Project.clone_dir(slug, owner, project_name,git)
1912
1911
  project_home = Dir.pwd + "/" + project_name
@@ -2893,7 +2892,7 @@ module Cnvrg
2893
2892
  end
2894
2893
  end
2895
2894
 
2896
- desc 'show', 'Show specific file from a specific commit'
2895
+ desc 'show', 'Show specific file from a specific commit', :hide => true
2897
2896
  method_option :path, :type => :string, :aliases => ["-p"], :desc => "File path", :default => ""
2898
2897
  method_option :commit, :type => :string, :aliases => ["-c"], :desc => "Commit sha1", :default => nil
2899
2898
 
@@ -4806,8 +4805,7 @@ module Cnvrg
4806
4805
 
4807
4806
  end
4808
4807
 
4809
- desc 'list_machines', 'Lists all machines belong to your organization'
4810
-
4808
+ desc 'list_machines', 'Lists all machines belong to your organization', :hide => true
4811
4809
  def list_machines
4812
4810
  begin
4813
4811
  verify_logged_in(false)
@@ -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).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
 
@@ -115,7 +115,7 @@ module Cnvrg
115
115
  #upload files
116
116
  blob_id_chunk = Parallel.map(files.keys, in_threads: ParallelThreads) do |file|
117
117
  begin
118
- Cnvrg::Helpers.try_until_success{self.upload_single_file(files[file].merge(parsed_chunk_of_files[file]))}
118
+ upload_single_file(files[file].merge(parsed_chunk_of_files[file]))
119
119
  rescue => e
120
120
  Cnvrg::CLI.log_message("Failed to upload #{file}: #{e.message}", 'red') unless suppress_exceptions
121
121
  Cnvrg::Logger.log_error(e)
@@ -188,7 +188,7 @@ module Cnvrg
188
188
  def upload_single_file(file)
189
189
  path = file['path']
190
190
  absolute_path = file[:absolute_path]
191
- @client.upload(path, absolute_path)
191
+ @client.safe_upload(path, absolute_path)
192
192
  end
193
193
 
194
194
  def parse_file(file)
@@ -3,7 +3,7 @@ module Cnvrg
3
3
 
4
4
  extend self
5
5
  def parallel_threads
6
- 15
6
+ 5
7
7
  end
8
8
 
9
9
  def self.parallel_options
@@ -1,3 +1,3 @@
1
1
  module Cnvrg
2
- VERSION = '1.10.18'
2
+ VERSION = '1.11.2'
3
3
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cnvrg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.18
4
+ version: 1.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yochay Ettun
8
8
  - Leah Kolben
9
9
  - Omer Shacham
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-09-15 00:00:00.000000000 Z
13
+ date: 2020-11-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -438,7 +438,7 @@ files:
438
438
  homepage: https://cnvrg.io
439
439
  licenses: []
440
440
  metadata: {}
441
- post_install_message:
441
+ post_install_message:
442
442
  rdoc_options: []
443
443
  require_paths:
444
444
  - lib
@@ -453,8 +453,8 @@ 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
457
- signing_key:
456
+ rubygems_version: 3.0.4
457
+ signing_key:
458
458
  specification_version: 4
459
459
  summary: A CLI tool for interacting with cnvrg.io.
460
460
  test_files: []