cnvrg 1.9.9.3 → 1.9.9.5

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: 53ddc2741cb68ba2e0a7952883931cbfc6fc6d0c92ba2a98cd99c3d4bac350ef
4
- data.tar.gz: 17a78f413fa1a65027826cf9d4a411176c938e9c260eae5d7813c19c9b6e5e56
3
+ metadata.gz: 8d2e4f14c9dfbb2875eebd2de45262eff3e4a2bc848e7d0305610092c84faa46
4
+ data.tar.gz: 6ba88a0190689ba218441f1f6c6d9307b71cf5a889a3649692aa556656e533ab
5
5
  SHA512:
6
- metadata.gz: c7bc53a1b26f86dc619a80c6bde93e93908916f665dd2e41742c1645cb855ac3b7f36ee1a32ed324204435ca18a6a6f6b4330cede901d1ae6a149affbb14f6a4
7
- data.tar.gz: b17527598197acdd1bc0f00b0f461dc38bb621674ffd2ac144cedc68a4b64097fc898c4b9f4f6c562657e656d1cfdcaa79acdae53ec00d7016d85bee2252f519
6
+ metadata.gz: cd22dd71906534018350166af1f23d20b8aa085dfb88b09d750974dd0f0229337a36efcdd34455ad9e0435846e7f4333bd5c4a5e3cf353ad8ca926ee011a8993
7
+ data.tar.gz: a4cae273a0000073d3955f60c0ebc5dd88c5b4ac1f28d5c09b1e99bbffe284446d8bee93bd97d33f2ba58052222d51c69c28a2c4bc31322205cf779e4adf7f2f
@@ -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, true, chunks: number_of_chunks, message: message )
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
- force: force,
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,false, success: true, commit_type: "put")
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?
@@ -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["force"]
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
@@ -302,13 +302,13 @@ module Cnvrg
302
302
  end
303
303
  end
304
304
 
305
- def request_upload_files(commit_sha1, tree, force, new_branch, partial_commit)
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
- force: force,
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, force: false, new_branch: false, prefix: '', partial_commit: nil)
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, force, new_branch, partial_commit)
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
- begin
1153
- #if we are pushing with force or to branch we dont need to send current/next commit cause we want to
1154
- # create a new commit.
1155
- idx = (force || new_branch) ? {} : dataset.get_idx
1156
- commit = idx[:commit]
1157
- next_commit = idx[:next_commit]
1158
- response = Cnvrg::API.request(
1159
- "#{base_resource}/commit/start",
1160
- 'POST',
1161
- {
1162
- dataset_slug: @dataset_slug,
1163
- new_branch: new_branch,
1164
- force:force,
1165
- username: @owner,
1166
- current_commit: commit,
1167
- next_commit: next_commit,
1168
- total_chunks: chunks,
1169
- message: message
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
- return response
1174
- rescue => e
1175
- return false
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)
@@ -1,3 +1,3 @@
1
1
  module Cnvrg
2
- VERSION = '1.9.9.3'
2
+ VERSION = '1.9.9.5'
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.9.9.3
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-15 00:00:00.000000000 Z
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.1.2
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.