cnvrg 1.9.9.9 → 1.9.9.9.4
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 +4 -4
- data/lib/cnvrg/cli.rb +9 -5
- data/lib/cnvrg/files.rb +48 -42
- 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: abe86787c977039f70850a0c0a5dbe203930f5cf5a6bd20dc6c3b8f8ed6cb21c
|
|
4
|
+
data.tar.gz: 4fb12784ae1d4452d71dbd069cc3be2898b3244401a801339b72ce0102da24e5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2663d0d5c0733b7fff8d20fe798fe395f5df856b444af9f51253bc31b0fefd380d78e616651ee0b4280b6d29dc9bac7564d6cd4b7c7835ad190e1e5966215b7e
|
|
7
|
+
data.tar.gz: afe2c81bb5f884692dc5cd16b5984ab30a60c4ad27c434ed16462e307fcf867ecfaedc9e78034fb3427a1d1fc7e7bca1b47237e803fe2ec36601dac1d313b236
|
data/lib/cnvrg/cli.rb
CHANGED
|
@@ -2274,13 +2274,16 @@ module Cnvrg
|
|
|
2274
2274
|
method_option :job_type, :type => :string, :aliases => [ "--job_type"], :default => nil, :hide=>true
|
|
2275
2275
|
method_option :suppress_exceptions, :type => :boolean, :aliases => ["--suppress-exceptions"], :default => true
|
|
2276
2276
|
method_option :debug_mode, :type => :boolean, :aliases => ["--debug-mode"], :default => false
|
|
2277
|
+
method_option :chunk_size, :type => :numeric, :aliases => ["--chunk"], :default => 100
|
|
2277
2278
|
|
|
2278
|
-
def upload(link = false, sync = false, direct = false, ignore_list = "", in_exp = false, force = false, output_dir = "output", job_type = nil, job_slug = nil, suppress_exceptions = true)
|
|
2279
|
+
def upload(link = false, sync = false, direct = false, ignore_list = "", in_exp = false, force = false, output_dir = "output", job_type = nil, job_slug = nil, suppress_exceptions = true,chunk_size=100)
|
|
2279
2280
|
begin
|
|
2280
2281
|
# we are passing "force" twice.. doesnt really make sense :\\
|
|
2281
2282
|
verify_logged_in(true)
|
|
2282
2283
|
log_start(__method__, args, options)
|
|
2283
2284
|
@project = Project.new(get_project_home)
|
|
2285
|
+
chunk_size = chunk_size ? chunk_size : options["chunk_size"]
|
|
2286
|
+
|
|
2284
2287
|
|
|
2285
2288
|
# Enable local/experiment exception logging
|
|
2286
2289
|
suppress_exceptions = suppress_exceptions ? suppress_exceptions : options[:suppress_exceptions]
|
|
@@ -2396,7 +2399,7 @@ module Cnvrg
|
|
|
2396
2399
|
:total => (to_upload.size + deleted.size),
|
|
2397
2400
|
:autofinish => true)
|
|
2398
2401
|
|
|
2399
|
-
buffered_errors = @files.
|
|
2402
|
+
buffered_errors = @files.upload_mrultiple_files(to_upload, commit_sha1, progress: progressbar, suppress_exceptions: suppress_exceptions, chunk_size: chunk_size)
|
|
2400
2403
|
@files.delete_files_from_server(deleted, commit_sha1, suppress_exceptions: suppress_exceptions)
|
|
2401
2404
|
|
|
2402
2405
|
progressbar.finish
|
|
@@ -2970,7 +2973,7 @@ module Cnvrg
|
|
|
2970
2973
|
method_option :git_diff, :type => :boolean, :aliases => ["--git_diff"], :default => false
|
|
2971
2974
|
method_option :suppress_exceptions, :type => :boolean, :aliases => ["--suppress-exceptions"], :default => true
|
|
2972
2975
|
method_option :debug_mode, :type => :boolean, :aliases => ["--debug-mode"], :default => false
|
|
2973
|
-
method_option :
|
|
2976
|
+
method_option :chunk_size, :type => :numeric, :aliases => ["--chunk"], :default => 100
|
|
2974
2977
|
|
|
2975
2978
|
def sync(direct = true)
|
|
2976
2979
|
verify_logged_in(true) if direct
|
|
@@ -2995,7 +2998,8 @@ module Cnvrg
|
|
|
2995
2998
|
end
|
|
2996
2999
|
invoke :upload, [false, true, direct, "",in_exp,options[:force], output_dir, job_type, job_slug ], :new_branch => options["new_branch"], :verbose => options["verbose"], :sync => true,
|
|
2997
3000
|
:ignore => options[:ignore], :force => options[:force], :message => options[:message], :deploy => options["deploy"], :return_id => options["return_id"],
|
|
2998
|
-
:files => options["files"], :output_dir => output_dir, :job_slug => job_slug, :job_type => job_type, :suppress_exceptions => options["suppress_exceptions"],
|
|
3001
|
+
:files => options["files"], :output_dir => output_dir, :job_slug => job_slug, :job_type => job_type, :suppress_exceptions => options["suppress_exceptions"],
|
|
3002
|
+
:debug_mode => options['debug_mode'], :git_diff => options["git_diff"], :chunk_size => options["chunk_size"]
|
|
2999
3003
|
|
|
3000
3004
|
end
|
|
3001
3005
|
|
|
@@ -3288,7 +3292,7 @@ module Cnvrg
|
|
|
3288
3292
|
puts line
|
|
3289
3293
|
end
|
|
3290
3294
|
log << cur_log
|
|
3291
|
-
if log.size >=
|
|
3295
|
+
if log.size >= 10
|
|
3292
3296
|
@exp.upload_temp_log(log) unless log.empty?
|
|
3293
3297
|
log = []
|
|
3294
3298
|
elsif (start_time + 15.seconds) <= Time.now
|
data/lib/cnvrg/files.rb
CHANGED
|
@@ -86,7 +86,7 @@ module Cnvrg
|
|
|
86
86
|
end
|
|
87
87
|
end
|
|
88
88
|
|
|
89
|
-
def upload_multiple_files(files_list, commit_sha1, progress: nil, suppress_exceptions: false)
|
|
89
|
+
def upload_multiple_files(files_list, commit_sha1, progress: nil, suppress_exceptions: false, chunk_size: 100)
|
|
90
90
|
#open files on the server.
|
|
91
91
|
Cnvrg::Logger.log_info("Uploading project files")
|
|
92
92
|
return if files_list.blank?
|
|
@@ -95,56 +95,62 @@ module Cnvrg
|
|
|
95
95
|
return self.upload_files_old(files_list, commit_sha1, progress: progress)
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
resp = Cnvrg::API.request(@base_resource + "upload_files", 'POST', {files: files_list, commit: commit_sha1})
|
|
100
|
-
unless Cnvrg::CLI.is_response_success(resp, false)
|
|
101
|
-
raise SignalException.new("Cant upload files to the server.")
|
|
102
|
-
end
|
|
103
|
-
# resolve bucket
|
|
104
|
-
res = resp['result']
|
|
105
|
-
files = res['files']
|
|
106
|
-
|
|
107
|
-
#upload files
|
|
108
|
-
token_mutex = Mutex.new
|
|
98
|
+
blob_ids = []
|
|
109
99
|
buffered_errors = {}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Cnvrg::Logger.log_error(e)
|
|
121
|
-
Cnvrg::Logger.log_method(bind: binding)
|
|
122
|
-
|
|
123
|
-
buffered_errors[file] = "Failed to upload #{file}: #{e.message}" if suppress_exceptions
|
|
124
|
-
|
|
125
|
-
raise e unless suppress_exceptions
|
|
100
|
+
files_list.each_slice(chunk_size).each do |chunk_of_files|
|
|
101
|
+
Cnvrg::Logger.log_info("Upload chunk")
|
|
102
|
+
parsed_chunk_of_files = chunk_of_files.map{|x| [x, self.parse_file(x)] if self.parse_file(x)}.compact.to_h
|
|
103
|
+
|
|
104
|
+
resp = Cnvrg::API.request(@base_resource + "upload_files", 'POST', {
|
|
105
|
+
files: parsed_chunk_of_files,
|
|
106
|
+
commit: commit_sha1
|
|
107
|
+
})
|
|
108
|
+
unless Cnvrg::CLI.is_response_success(resp, false)
|
|
109
|
+
raise SignalException.new("Cant upload files to the server.")
|
|
126
110
|
end
|
|
127
|
-
|
|
111
|
+
# resolve bucket
|
|
112
|
+
res = resp['result']
|
|
113
|
+
files = res['files']
|
|
114
|
+
|
|
115
|
+
#upload files
|
|
116
|
+
blob_id_chunk = Parallel.map(files.keys, in_threads: ParallelThreads) do |file|
|
|
117
|
+
begin
|
|
118
|
+
Cnvrg::Helpers.try_until_success{self.upload_single_file(files[file].merge(parsed_chunk_of_files[file]))}
|
|
119
|
+
rescue => e
|
|
120
|
+
Cnvrg::CLI.log_message("Failed to upload #{file}: #{e.message}", 'red') unless suppress_exceptions
|
|
121
|
+
Cnvrg::Logger.log_error(e)
|
|
122
|
+
Cnvrg::Logger.log_method(bind: binding)
|
|
123
|
+
|
|
124
|
+
buffered_errors[file] = "Failed to upload #{file}: #{e.message}" if suppress_exceptions
|
|
125
|
+
|
|
126
|
+
raise e unless suppress_exceptions
|
|
127
|
+
end
|
|
128
|
+
progress.progress += 1 if progress.present?
|
|
128
129
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
unless buffered_errors.key?(file)
|
|
131
|
+
files[file]["bv_id"]
|
|
132
|
+
else
|
|
133
|
+
nil
|
|
134
|
+
end
|
|
133
135
|
end
|
|
134
|
-
end
|
|
135
136
|
|
|
136
|
-
# remove nil files (failed files) from blob_ids
|
|
137
|
-
blob_ids.compact!
|
|
138
137
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
blob_ids.concat blob_id_chunk
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# remove nil files (failed files) from blob_ids
|
|
142
|
+
blob_ids.compact!
|
|
144
143
|
|
|
145
|
-
|
|
144
|
+
#save files on the server.
|
|
145
|
+
resp = Cnvrg::API.request(@base_resource + "upload_files_save", 'POST', {blob_ids: blob_ids, commit: commit_sha1})
|
|
146
|
+
unless Cnvrg::CLI.is_response_success(resp, false)
|
|
147
|
+
raise SignalException.new("Cant save uploaded files to the server.")
|
|
146
148
|
end
|
|
147
149
|
|
|
150
|
+
return buffered_errors
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
|
|
148
154
|
|
|
149
155
|
def delete_files_from_server_old(files, commit_sha1)
|
|
150
156
|
#files are absolute path here.
|
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: 1.9.9.9
|
|
4
|
+
version: 1.9.9.9.4
|
|
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-07-
|
|
13
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: bundler
|