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 +4 -4
- data/lib/cnvrg/cli.rb +12 -11
- data/lib/cnvrg/dataset.rb +24 -9
- data/lib/cnvrg/files.rb +2 -2
- data/lib/cnvrg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f3169f1879068224c90bee508cc59f70ea0511ddf035121f68fa3903a179cb6
|
4
|
+
data.tar.gz: '008d3c425851891ecc80363c141636c54a9ed3abcc3fa80083f5ef190a7bcba8'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3b9ad00997260f78fbdd3b492676847d85102ba2e87d6c54d64a8f0703250e87f01cd0346b797355f1206ff0b2c5dd2c1e2b70bbb50ec03dac2ff1a6f2a4c61
|
7
|
+
data.tar.gz: 87beff960a61713abab357b95e890c6e247fc3605f2cea7fed5767d259a728448a3bdfcd2e810833b4632f9794efc3e043e773ff600d47abf6d49d4792bc9953
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -896,10 +896,12 @@ module Cnvrg
|
|
896
896
|
return
|
897
897
|
end
|
898
898
|
|
899
|
+
|
899
900
|
if only_tree
|
900
|
-
|
901
|
-
return
|
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)
|
data/lib/cnvrg/dataset.rb
CHANGED
@@ -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
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
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
|
-
|
490
|
-
|
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
|
|
data/lib/cnvrg/files.rb
CHANGED
@@ -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
|
-
|
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.
|
191
|
+
@client.safe_upload(path, absolute_path)
|
192
192
|
end
|
193
193
|
|
194
194
|
def parse_file(file)
|
data/lib/cnvrg/version.rb
CHANGED
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:
|
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-
|
13
|
+
date: 2020-11-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|