cnvrg 1.9.9.6 → 1.9.9.9.5
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 +9 -5
- data/lib/cnvrg/datafiles.rb +2 -1
- data/lib/cnvrg/files.rb +48 -42
- data/lib/cnvrg/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2b4e4f9fec5ba43fc66cec1bafd254e9c69911dc8b5f7a786f2628a7460b12a
|
4
|
+
data.tar.gz: 262df246fbaae19a9c20fddfddb7e39f1a9813e50588951d31bcde8988d456e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 554850cc31a667e7a5494833c6cbedbd38e40e0cc9ebd4a0d13904c6edb33f25b0655d76f837eb2a0912bf4a509f3dea6ef2591897f272ee9e4e0f39f82f04f0
|
7
|
+
data.tar.gz: 5ded18aca1079b010efbd7f8fb025debe9fc6af17621286db1142932a665069effea73d75f7bd8188a02e4e8f4ef59c19ba8baf525877a0282fae1051917db4d
|
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/datafiles.rb
CHANGED
@@ -168,7 +168,7 @@ module Cnvrg
|
|
168
168
|
error = nil
|
169
169
|
upload_resp = nil
|
170
170
|
10.times do
|
171
|
-
upload_resp = Cnvrg::API.request(@base_resource + "upload_files", 'POST_JSON', {commit_sha1: commit_sha1, tree: tree, override: force, is_branch: new_branch, partial_commit: partial_commit})
|
171
|
+
upload_resp = Cnvrg::API.request(@base_resource + "upload_files", 'POST_JSON', {commit_sha1: commit_sha1, tree: tree, force: force, override: force, is_branch: new_branch, partial_commit: partial_commit})
|
172
172
|
if Cnvrg::CLI.is_response_success(upload_resp, false)
|
173
173
|
error = nil
|
174
174
|
break
|
@@ -308,6 +308,7 @@ module Cnvrg
|
|
308
308
|
commit_sha1: commit_sha1,
|
309
309
|
tree: tree,
|
310
310
|
override: override,
|
311
|
+
force: override,
|
311
312
|
is_branch: new_branch,
|
312
313
|
partial_commit: partial_commit
|
313
314
|
})
|
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.
|
4
|
+
version: 1.9.9.9.5
|
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
|
@@ -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.
|
456
|
+
rubygems_version: 3.1.2
|
457
457
|
signing_key:
|
458
458
|
specification_version: 4
|
459
459
|
summary: A CLI tool for interacting with cnvrg.io.
|