cnvrg 1.11 → 1.11.6

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: 04a9acd0283e8ef3c4aacfa23c90d2954e3e0a2ad4f2a70eed66ea0b87144956
4
- data.tar.gz: 8221939940f215d62f6c5a66705cbdd20f6218c87007d2f71d9a4fdba0af5285
3
+ metadata.gz: 6f3169f1879068224c90bee508cc59f70ea0511ddf035121f68fa3903a179cb6
4
+ data.tar.gz: '008d3c425851891ecc80363c141636c54a9ed3abcc3fa80083f5ef190a7bcba8'
5
5
  SHA512:
6
- metadata.gz: 286544fb7129aef8fa679aa3daacdfa983cc10154709ceadbaf58406676780225559702b41195182156a379e0f4c6bc192d067eb39a7476a605bd9381f504597
7
- data.tar.gz: '09e9a6a66e91b29afd2940b02d424785556cce005d1b966e7f3e82c6eb448014d6c8657570c4305274fae7b1d34f824520f6e12a90688f069dfaa8facad5d1b8'
6
+ metadata.gz: a3b9ad00997260f78fbdd3b492676847d85102ba2e87d6c54d64a8f0703250e87f01cd0346b797355f1206ff0b2c5dd2c1e2b70bbb50ec03dac2ff1a6f2a4c61
7
+ data.tar.gz: 87beff960a61713abab357b95e890c6e247fc3605f2cea7fed5767d259a728448a3bdfcd2e810833b4632f9794efc3e043e773ff600d47abf6d49d4792bc9953
@@ -896,10 +896,12 @@ module Cnvrg
896
896
  return
897
897
  end
898
898
 
899
+
899
900
  if only_tree
900
- success = Dataset.clone_tree(commit: commit, dataset_home: dataset_home)
901
- return if success
901
+ Dataset.clone_tree(commit: commit, dataset_home: dataset_home)
902
+ return
902
903
  end
904
+
903
905
  commit = response["result"]["commit"]
904
906
  files_count = response["result"]["file_count"]
905
907
  files = @files.get_clone_chunk(commit: commit)
@@ -911,6 +913,7 @@ module Cnvrg
911
913
  :total => files_count,
912
914
  :autofinish => true)
913
915
 
916
+ Dataset.clone_tree(commit: commit, dataset_home: dataset_home, progressbar: progressbar)
914
917
 
915
918
  while files['keys'].length > 0
916
919
  Cnvrg::Logger.log_info("download multiple files, #{downloaded_files.size} files downloaded")
@@ -964,10 +967,9 @@ module Cnvrg
964
967
  Cnvrg::CLI.is_response_success(response,true)
965
968
  dataset_name = response["results"]["name"]
966
969
  dataset_slug = response["results"]["slug"]
967
- dataset_home = Dir.pwd+"/"+dataset_slug
970
+ dataset_home = Dir.pwd + "/" + dataset_slug
968
971
  Dataset.stop_if_dataset_present(dataset_home, dataset_name) if soft
969
972
 
970
- # dataset_home = Dir.pwd
971
973
  if Dataset.blank_clone(owner, dataset_name, dataset_slug)
972
974
  dataset = Dataset.new(dataset_home)
973
975
  log_message("Cloning #{dataset_name}", Thor::Shell::Color::BLUE)
@@ -986,12 +988,13 @@ module Cnvrg
986
988
  begin
987
989
  log_message("Downloading files", Thor::Shell::Color::BLUE)
988
990
  Parallel.map((response["results"]["query_files"]), parallel_options) do |f|
989
- relative_path = f["fullpath"].gsub(/^#{dataset_home}/, "")
991
+ relative_path = f["fullpath"].gsub(/^#{dataset_home}/, "").gsub(/^#{slug}/, "")
990
992
  relative_path_dir = relative_path.split("/")
991
993
  file_name = relative_path_dir.pop()
992
994
  relative_path_dir = relative_path_dir.join("/")
993
995
  abs_path = dataset_home + "/" + relative_path_dir
994
996
  abs_path = dataset_home if flatten
997
+
995
998
  begin
996
999
  FileUtils.mkdir_p(abs_path) unless File.exist? (abs_path + "/" + file_name)
997
1000
  rescue
@@ -1781,8 +1784,7 @@ module Cnvrg
1781
1784
  print_table(list)
1782
1785
  end
1783
1786
 
1784
- desc 'commits', 'List all commits for a specific Project'
1785
-
1787
+ desc 'commits', 'List all commits for a specific Project', :hide => true
1786
1788
  def list_commits()
1787
1789
  verify_logged_in(true)
1788
1790
  log_start(__method__, args, options)
@@ -1796,7 +1798,7 @@ module Cnvrg
1796
1798
  end
1797
1799
 
1798
1800
 
1799
- desc 'unlink', 'Unlink a project from current directory'
1801
+ desc 'unlink', 'Unlink a project from current directory', :hide => true
1800
1802
 
1801
1803
  def unlink
1802
1804
  verify_logged_in(false)
@@ -2893,7 +2895,7 @@ module Cnvrg
2893
2895
  end
2894
2896
  end
2895
2897
 
2896
- desc 'show', 'Show specific file from a specific commit'
2898
+ desc 'show', 'Show specific file from a specific commit', :hide => true
2897
2899
  method_option :path, :type => :string, :aliases => ["-p"], :desc => "File path", :default => ""
2898
2900
  method_option :commit, :type => :string, :aliases => ["-c"], :desc => "Commit sha1", :default => nil
2899
2901
 
@@ -4806,8 +4808,7 @@ module Cnvrg
4806
4808
 
4807
4809
  end
4808
4810
 
4809
- desc 'list_machines', 'Lists all machines belong to your organization'
4810
-
4811
+ desc 'list_machines', 'Lists all machines belong to your organization', :hide => true
4811
4812
  def list_machines
4812
4813
  begin
4813
4814
  verify_logged_in(false)
@@ -471,23 +471,38 @@ module Cnvrg
471
471
  response.to_json
472
472
  end
473
473
 
474
- def self.clone_tree(commit: 'latest', dataset_home: nil)
474
+ def self.clone_tree(commit: 'latest', dataset_home: nil, progressbar: nil)
475
475
  @dataset = Cnvrg::Dataset.new(dataset_home)
476
476
  @files = Cnvrg::Datafiles.new(@dataset.owner, @dataset.slug, dataset: @dataset)
477
477
  trees = @files.get_trees(commit: commit)
478
478
  return false if trees.nil?
479
- pb = ProgressBar.create(:title => "Download Progress",
480
- :progress_mark => '=',
481
- :format => "%b>>%i| %p%% %t",
482
- :starting_at => 0,
483
- :total => trees.size,
484
- :autofinish => true)
479
+
480
+ if progressbar
481
+ pb = progressbar
482
+ pb.total += trees.size
483
+ else
484
+ pb = ProgressBar.create(
485
+ :title => "Download Progress",
486
+ :progress_mark => '=',
487
+ :format => "%b>>%i| %p%% %t",
488
+ :starting_at => 0,
489
+ :total => trees.size,
490
+ :autofinish => true
491
+ )
492
+ end
493
+
485
494
  trees.each do |tree|
486
495
  pb.progress += 1
487
496
  @files.download_dir(dataset_home, tree)
488
497
  end
489
- pb.finish
490
- @dataset.write_success
498
+
499
+ unless progressbar
500
+ # if progessbar sent it means that its not only tree so we dont want to finish the progress bar
501
+ # and we dont want to write success
502
+
503
+ pb.finish
504
+ @dataset.write_success
505
+ end
491
506
  true
492
507
  end
493
508
 
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Cnvrg
2
- VERSION = '1.11'
2
+ VERSION = '1.11.6'
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.11'
4
+ version: 1.11.6
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-23 00:00:00.000000000 Z
13
+ date: 2020-11-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler