cnvrg 1.6.22 → 1.6.23
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 +20 -8
- data/lib/cnvrg/data.rb +3 -1
- data/lib/cnvrg/datafiles.rb +11 -0
- 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: e02d88ff10cc1d512fcc462c36a2414c369db01d9f153e3fcd7e0c16323a7ed3
|
4
|
+
data.tar.gz: 4d229c75a62ddeaef049878712f6efd5a9ed9d2282ce178c5668a16ca151b341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb33e353617be53f4b0644189709830413e02c758d70043a51c6674493578d12411bec4cc50590ca2956f731f08043842783f984bca588618714a7c122e1cbe9
|
7
|
+
data.tar.gz: 19ea024dda8473f01bae568c7ed5f8cea6ec55475e044f6eb25d96cd58fb852dcc33fe6ba0b1c0b55290f46bd2cf5977710e6d9f5df8940b920e836a74f46c09
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -1184,7 +1184,7 @@ module Cnvrg
|
|
1184
1184
|
end
|
1185
1185
|
|
1186
1186
|
desc '', '', :hide => true
|
1187
|
-
def data_put(dataset_url, files: [], dir: '', chunk_size: 1000)
|
1187
|
+
def data_put(dataset_url, files: [], dir: '', commit: '', chunk_size: 1000)
|
1188
1188
|
begin
|
1189
1189
|
verify_logged_in(false)
|
1190
1190
|
log_start(__method__, args, options)
|
@@ -1203,11 +1203,21 @@ module Cnvrg
|
|
1203
1203
|
end
|
1204
1204
|
log_message("Uploading #{@files.size} files", Thor::Shell::Color::GREEN)
|
1205
1205
|
number_of_chunks = (@files.size.to_f / chunk_size).ceil
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1206
|
+
if commit.blank?
|
1207
|
+
response = @datafiles.start_commit(false, true, chunks: number_of_chunks)
|
1208
|
+
unless response #means we failed in the start commit.
|
1209
|
+
raise SignalException.new(1, "Cant put files into dataset, check the dataset id")
|
1210
|
+
end
|
1211
|
+
@commit = response['result']['commit_sha1']
|
1212
|
+
elsif commit.eql? "latest"
|
1213
|
+
response = @datafiles.last_valid_commit()
|
1214
|
+
unless response #means we failed in the start commit.
|
1215
|
+
raise SignalException.new(1, "Cant put files into commit:#{commit}, check the dataset id and commitc")
|
1216
|
+
end
|
1217
|
+
@commit = response['result']['sha1']
|
1218
|
+
else
|
1219
|
+
@commit = commit
|
1209
1220
|
end
|
1210
|
-
@commit = response['result']['commit_sha1']
|
1211
1221
|
#dir shouldnt have starting or ending slash.
|
1212
1222
|
dir = dir[0..-2] if dir.end_with? '/'
|
1213
1223
|
dir = dir[1..-1] if dir.start_with? '/'
|
@@ -1217,9 +1227,11 @@ module Cnvrg
|
|
1217
1227
|
#will throw a signal exception if something goes wrong.
|
1218
1228
|
@datafiles.upload_multiple_files(@commit, temp_tree, force: true, prefix: dir, total: @files.size)
|
1219
1229
|
end
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1230
|
+
if commit.blank?
|
1231
|
+
res = @datafiles.put_commit(@commit)
|
1232
|
+
unless res.is_success?
|
1233
|
+
raise SignalException.new(1, res.msg)
|
1234
|
+
end
|
1223
1235
|
end
|
1224
1236
|
log_message("Upload finished Successfully", Thor::Shell::Color::GREEN)
|
1225
1237
|
rescue SignalException => e
|
data/lib/cnvrg/data.rb
CHANGED
@@ -185,10 +185,12 @@ module Cnvrg
|
|
185
185
|
|
186
186
|
desc 'data put DATASET_URL FILES_PREFIX', 'Upload selected files from local dataset directory to remote server'
|
187
187
|
method_option :dir, :type => :string, :aliases => ["-d", "--dir"], :default => ''
|
188
|
+
method_option :commit, :type => :string, :aliases => ["-c", "--commit"], :default => ''
|
188
189
|
def put(dataset_url, *files)
|
189
190
|
cli = Cnvrg::CLI.new()
|
190
191
|
dir = options[:dir]
|
191
|
-
|
192
|
+
commit = options[:commit]
|
193
|
+
cli.data_put(dataset_url, files: files, dir: dir, commit: commit)
|
192
194
|
end
|
193
195
|
|
194
196
|
desc 'data clone_query --query=QUERY_SLUG DATASET_URL', 'Clone dataset with specific query'
|
data/lib/cnvrg/datafiles.rb
CHANGED
@@ -898,6 +898,17 @@ module Cnvrg
|
|
898
898
|
return false
|
899
899
|
end
|
900
900
|
end
|
901
|
+
def last_valid_commit()
|
902
|
+
begin
|
903
|
+
#if we are pushing with force or to branch we dont need to send current/next commit cause we want to
|
904
|
+
# create a new commit.
|
905
|
+
response = Cnvrg::API.request("#{base_resource}/last_valid_commit", 'GET')
|
906
|
+
Cnvrg::CLI.is_response_success(response, true)
|
907
|
+
return response
|
908
|
+
rescue => e
|
909
|
+
return false
|
910
|
+
end
|
911
|
+
end
|
901
912
|
|
902
913
|
def end_commit(commit_sha1,force, success: true, uploaded_files: 0 )
|
903
914
|
begin
|
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.6.
|
4
|
+
version: 1.6.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yochay Ettun
|
@@ -477,7 +477,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
477
477
|
- !ruby/object:Gem::Version
|
478
478
|
version: '0'
|
479
479
|
requirements: []
|
480
|
-
rubygems_version: 3.0.
|
480
|
+
rubygems_version: 3.0.4
|
481
481
|
signing_key:
|
482
482
|
specification_version: 4
|
483
483
|
summary: A CLI tool for interacting with cnvrg.io.
|