cnvrg 1.9.9.3 → 1.9.9.5
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 +4 -4
- data/lib/cnvrg/data.rb +5 -1
- data/lib/cnvrg/datafiles.rb +26 -40
- 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: 8d2e4f14c9dfbb2875eebd2de45262eff3e4a2bc848e7d0305610092c84faa46
|
|
4
|
+
data.tar.gz: 6ba88a0190689ba218441f1f6c6d9307b71cf5a889a3649692aa556656e533ab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd22dd71906534018350166af1f23d20b8aa085dfb88b09d750974dd0f0229337a36efcdd34455ad9e0435846e7f4333bd5c4a5e3cf353ad8ca926ee011a8993
|
|
7
|
+
data.tar.gz: a4cae273a0000073d3955f60c0ebc5dd88c5b4ac1f28d5c09b1e99bbffe284446d8bee93bd97d33f2ba58052222d51c69c28a2c4bc31322205cf779e4adf7f2f
|
data/lib/cnvrg/cli.rb
CHANGED
|
@@ -1191,7 +1191,7 @@ module Cnvrg
|
|
|
1191
1191
|
end
|
|
1192
1192
|
|
|
1193
1193
|
desc '', '', :hide => true
|
|
1194
|
-
def data_put(dataset_url, files: [], dir: '', commit: '', chunk_size: 1000, force: false, threads: 15, message: nil)
|
|
1194
|
+
def data_put(dataset_url, files: [], dir: '', commit: '', chunk_size: 1000, force: false, override: false, threads: 15, message: nil)
|
|
1195
1195
|
begin
|
|
1196
1196
|
verify_logged_in(false)
|
|
1197
1197
|
log_start(__method__, args, options)
|
|
@@ -1207,7 +1207,7 @@ module Cnvrg
|
|
|
1207
1207
|
log_message("Uploading #{@files.size} files", Thor::Shell::Color::GREEN)
|
|
1208
1208
|
number_of_chunks = (@files.size.to_f / chunk_size).ceil
|
|
1209
1209
|
if commit.blank?
|
|
1210
|
-
response = @datafiles.start_commit(false,
|
|
1210
|
+
response = @datafiles.start_commit(false, force, chunks: number_of_chunks, message: message )
|
|
1211
1211
|
unless response #means we failed in the start commit.
|
|
1212
1212
|
raise SignalException.new(1, "Cant put files into dataset, check the dataset id")
|
|
1213
1213
|
end
|
|
@@ -1229,7 +1229,7 @@ module Cnvrg
|
|
|
1229
1229
|
@datafiles.upload_multiple_files_optimized(
|
|
1230
1230
|
@files,
|
|
1231
1231
|
@commit,
|
|
1232
|
-
|
|
1232
|
+
override: override,
|
|
1233
1233
|
chunk_size: chunk_size,
|
|
1234
1234
|
prefix: dir,
|
|
1235
1235
|
threads: threads
|
|
@@ -1241,7 +1241,7 @@ module Cnvrg
|
|
|
1241
1241
|
raise SignalException.new(1, res.msg)
|
|
1242
1242
|
end
|
|
1243
1243
|
|
|
1244
|
-
res = @datafiles.end_commit(@commit,
|
|
1244
|
+
res = @datafiles.end_commit(@commit,force, success: true, commit_type: "put")
|
|
1245
1245
|
msg = res['result']
|
|
1246
1246
|
response = Cnvrg::Result.new(Cnvrg::CLI.is_response_success(res, true), msg)
|
|
1247
1247
|
unless response.is_success?
|
data/lib/cnvrg/data.rb
CHANGED
|
@@ -213,13 +213,16 @@ module Cnvrg
|
|
|
213
213
|
method_option :dir, :type => :string, :aliases => ["-d", "--dir"], :default => ''
|
|
214
214
|
method_option :commit, :type => :string, :aliases => ["-c", "--commit"], :default => ''
|
|
215
215
|
method_option :force, :type => :boolean, :aliases => ["-f","--force"], :default => false
|
|
216
|
+
method_option :override, :type => :boolean, :aliases => ["--override"], :default => false
|
|
216
217
|
method_option :threads, :type => :numeric, :aliases => ["-t","--threads"], :default => 15
|
|
217
218
|
method_option :chunk_size, :type => :numeric, :aliases => ["-cs","--chunk"], :default => 1000
|
|
218
219
|
method_option :message, :type => :string, :aliases => ["--message"], :desc => "create commit with message", :default => nil
|
|
220
|
+
|
|
219
221
|
def put(dataset_url, *files)
|
|
220
222
|
cli = Cnvrg::CLI.new()
|
|
221
223
|
dir = options[:dir]
|
|
222
|
-
force = options[
|
|
224
|
+
force = options[:force]
|
|
225
|
+
override = options[:override]
|
|
223
226
|
commit = options[:commit]
|
|
224
227
|
message = options[:message]
|
|
225
228
|
threads = options[:threads]
|
|
@@ -230,6 +233,7 @@ module Cnvrg
|
|
|
230
233
|
dir: dir,
|
|
231
234
|
commit: commit,
|
|
232
235
|
force: force,
|
|
236
|
+
override: override,
|
|
233
237
|
threads: threads,
|
|
234
238
|
chunk_size: chunk_size,
|
|
235
239
|
message: message
|
data/lib/cnvrg/datafiles.rb
CHANGED
|
@@ -302,13 +302,13 @@ module Cnvrg
|
|
|
302
302
|
end
|
|
303
303
|
end
|
|
304
304
|
|
|
305
|
-
def request_upload_files(commit_sha1, tree,
|
|
305
|
+
def request_upload_files(commit_sha1, tree, override, new_branch, partial_commit)
|
|
306
306
|
retry_count = 0
|
|
307
307
|
loop do
|
|
308
308
|
upload_resp = Cnvrg::API.request(@base_resource + "upload_files", 'POST_JSON', {
|
|
309
309
|
commit_sha1: commit_sha1,
|
|
310
310
|
tree: tree,
|
|
311
|
-
|
|
311
|
+
override: override,
|
|
312
312
|
is_branch: new_branch,
|
|
313
313
|
partial_commit: partial_commit
|
|
314
314
|
})
|
|
@@ -330,7 +330,7 @@ module Cnvrg
|
|
|
330
330
|
|
|
331
331
|
end
|
|
332
332
|
|
|
333
|
-
def upload_multiple_files_optimized(files, commit_sha1, threads: 15, chunk_size: 1000,
|
|
333
|
+
def upload_multiple_files_optimized(files, commit_sha1, threads: 15, chunk_size: 1000, override: false, new_branch: false, prefix: '', partial_commit: nil)
|
|
334
334
|
cli = CLI.new
|
|
335
335
|
cli.log_message("Using #{threads} threads with chunk size of #{chunk_size}.", Thor::Shell::Color::GREEN)
|
|
336
336
|
|
|
@@ -407,7 +407,7 @@ module Cnvrg
|
|
|
407
407
|
Parallel.map((file_chunks), in_threads: 10) do |files_chunk|
|
|
408
408
|
|
|
409
409
|
tree = @dataset.generate_chunked_idx(files_chunk, prefix: prefix, threads: threads)
|
|
410
|
-
results = request_upload_files(commit_sha1, tree,
|
|
410
|
+
results = request_upload_files(commit_sha1, tree, override, new_branch, partial_commit)
|
|
411
411
|
|
|
412
412
|
# puts "Got #{results['files'].size} files to upload from #{files_chunk.size} files"
|
|
413
413
|
|
|
@@ -1149,43 +1149,29 @@ module Cnvrg
|
|
|
1149
1149
|
end
|
|
1150
1150
|
|
|
1151
1151
|
def start_commit(new_branch, force=false, chunks: 0, dataset: @dataset, message:nil)
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
)
|
|
1152
|
+
#if we are pushing with force or to branch we dont need to send current/next commit cause we want to
|
|
1153
|
+
# create a new commit.
|
|
1154
|
+
idx = {}
|
|
1155
|
+
commit = idx[:commit]
|
|
1156
|
+
next_commit = idx[:next_commit]
|
|
1157
|
+
response = Cnvrg::API.request(
|
|
1158
|
+
"#{base_resource}/commit/start",
|
|
1159
|
+
'POST',
|
|
1160
|
+
{
|
|
1161
|
+
dataset_slug: @dataset_slug,
|
|
1162
|
+
new_branch: new_branch,
|
|
1163
|
+
force:force,
|
|
1164
|
+
username: @owner,
|
|
1165
|
+
current_commit: commit,
|
|
1166
|
+
next_commit: next_commit,
|
|
1167
|
+
total_chunks: chunks,
|
|
1168
|
+
message: message
|
|
1169
|
+
}
|
|
1170
|
+
)
|
|
1172
1171
|
Cnvrg::CLI.is_response_success(response, true)
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
end
|
|
1177
|
-
end
|
|
1178
|
-
|
|
1179
|
-
def last_valid_commit()
|
|
1180
|
-
begin
|
|
1181
|
-
#if we are pushing with force or to branch we dont need to send current/next commit cause we want to
|
|
1182
|
-
# create a new commit.
|
|
1183
|
-
response = Cnvrg::API.request("#{base_resource}/last_valid_commit", 'GET')
|
|
1184
|
-
Cnvrg::CLI.is_response_success(response, true)
|
|
1185
|
-
return response
|
|
1186
|
-
rescue => e
|
|
1187
|
-
return false
|
|
1188
|
-
end
|
|
1172
|
+
response
|
|
1173
|
+
rescue => e
|
|
1174
|
+
false
|
|
1189
1175
|
end
|
|
1190
1176
|
|
|
1191
1177
|
def end_commit(commit_sha1, force, success: true, uploaded_files: 0, commit_type: nil)
|
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.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-19 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.0.4
|
|
457
457
|
signing_key:
|
|
458
458
|
specification_version: 4
|
|
459
459
|
summary: A CLI tool for interacting with cnvrg.io.
|