cnvrg 0.0.146 → 0.0.147
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 +27 -4
- data/lib/cnvrg/datafiles.rb +0 -4
- data/lib/cnvrg/dataset.rb +7 -0
- data/lib/cnvrg/files.rb +0 -3
- data/lib/cnvrg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a089a8118adb94a9ae9b8c37e75b6bdf8690eaf9
|
4
|
+
data.tar.gz: aef1c463d671068e6c7dcaa288f40a4d8b3af303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a12c9b7ad5001f6c8e323ba82851cf3a23398761a6e0c90d72a09d38712a34b9a008e59256006e521f4b498e3bebe572de51ead008b0b75fc877b41f6fbc9c34
|
7
|
+
data.tar.gz: d0859793528290bee4e56f8ce6f1adb70cc7e1ffeead7cc5dab33e2a85df4d59e43eb0319856ced6f031831d5609c52a75dcb563b2f0a3a1b31238c14da6c6f7
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -34,7 +34,6 @@ require 'thor'
|
|
34
34
|
require 'pathname'
|
35
35
|
require 'cnvrg/data'
|
36
36
|
|
37
|
-
|
38
37
|
# DEV VERSION
|
39
38
|
|
40
39
|
#
|
@@ -599,11 +598,34 @@ module Cnvrg
|
|
599
598
|
exit(1)
|
600
599
|
end
|
601
600
|
end
|
601
|
+
desc 'data_snap', 'Init dataset directory', :hide =>true
|
602
|
+
method_option :public, :type => :boolean, :aliases => ["-p", "--public"], :default => false
|
603
|
+
|
604
|
+
def snap_data
|
605
|
+
begin
|
606
|
+
verify_logged_in(false)
|
607
|
+
log_start(__method__, args, options)
|
608
|
+
|
609
|
+
owner = CLI.get_owner
|
610
|
+
path = Dir.pwd
|
611
|
+
@dataset = Dataset.new(path)
|
612
|
+
puts @dataset.snapshot
|
613
|
+
|
614
|
+
log_end(0)
|
615
|
+
|
616
|
+
rescue SignalException
|
617
|
+
log_end(-1)
|
618
|
+
|
619
|
+
say "\nAborting"
|
620
|
+
exit(1)
|
621
|
+
end
|
622
|
+
end
|
623
|
+
|
602
624
|
desc 'upload_data', 'Upload data files', :hide=>true
|
603
625
|
method_option :ignore, :type => :array, :aliases => ["-i", "--i"], :desc => "ignore following files"
|
604
626
|
method_option :new_branch, :type => :boolean, :aliases => ["-nb", "--nb"], :desc => "create new branch of commits"
|
605
|
-
method_option :verbose, :type => :boolean, :aliases => ["
|
606
|
-
method_option :sync, :type => :boolean, :aliases => ["
|
627
|
+
method_option :verbose, :type => :boolean, :aliases => ["-v"], :default => false
|
628
|
+
method_option :sync, :type => :boolean, :aliases => ["-s"], :default => false
|
607
629
|
|
608
630
|
def upload_data(sync=false,direct=false)
|
609
631
|
|
@@ -619,6 +641,7 @@ module Cnvrg
|
|
619
641
|
say "Couldn't append new ignore files to .cnvrgignore", Thor::Shell::Color::YELLOW
|
620
642
|
end
|
621
643
|
result = @dataset.compare_idx(false)
|
644
|
+
|
622
645
|
commit = result["result"]["commit"]
|
623
646
|
if commit != @dataset.last_local_commit and !@dataset.last_local_commit.nil? and !result["result"]["tree"]["updated_on_server"].empty?
|
624
647
|
log_end(0)
|
@@ -667,7 +690,6 @@ module Cnvrg
|
|
667
690
|
# Start commit
|
668
691
|
|
669
692
|
commit_sha1 = @files.start_commit(false)["result"]["commit_sha1"]
|
670
|
-
|
671
693
|
# upload / update
|
672
694
|
begin
|
673
695
|
(result["added"] + result["updated_on_local"]).each do |f|
|
@@ -681,6 +703,7 @@ module Cnvrg
|
|
681
703
|
end
|
682
704
|
else
|
683
705
|
res = @files.upload_file(absolute_path, relative_path, commit_sha1)
|
706
|
+
|
684
707
|
if res
|
685
708
|
update_count += 1
|
686
709
|
successful_updates<< relative_path
|
data/lib/cnvrg/datafiles.rb
CHANGED
@@ -213,8 +213,6 @@ module Cnvrg
|
|
213
213
|
body = response.read_body
|
214
214
|
end
|
215
215
|
URLcrypt::key = [body].pack('H*')
|
216
|
-
puts "file_size: #{File.size(file_path).to_f}"
|
217
|
-
puts "start_time: #{Time.now}"
|
218
216
|
s3 = Aws::S3::Resource.new(
|
219
217
|
:access_key_id => URLcrypt.decrypt(upload_resp["result"]["sts_a"]),
|
220
218
|
:secret_access_key => URLcrypt.decrypt(upload_resp["result"]["sts_s"]),
|
@@ -223,8 +221,6 @@ module Cnvrg
|
|
223
221
|
resp = s3.bucket(URLcrypt.decrypt(upload_resp["result"]["bucket"])).
|
224
222
|
object(upload_resp["result"]["path"]+"/"+File.basename(file_path)).
|
225
223
|
upload_file(file_path,{:use_accelerate_endpoint=>true})
|
226
|
-
puts "end_time: #{Time.now}"
|
227
|
-
|
228
224
|
return resp
|
229
225
|
rescue =>e
|
230
226
|
puts e
|
data/lib/cnvrg/dataset.rb
CHANGED
@@ -24,6 +24,13 @@ module Cnvrg
|
|
24
24
|
return idx[:commit]
|
25
25
|
end
|
26
26
|
|
27
|
+
def snapshot
|
28
|
+
commit = last_local_commit
|
29
|
+
response = Cnvrg::API.request("users/#{self.owner}/datasets/#{self.slug}/volumes/create", 'POST', {data_commit: commit})
|
30
|
+
CLI.is_response_success(response)
|
31
|
+
return response
|
32
|
+
|
33
|
+
end
|
27
34
|
def url
|
28
35
|
url = Cnvrg::Helpers.remote_url
|
29
36
|
"#{url}/#{self.owner}/projects/#{self.slug}"
|
data/lib/cnvrg/files.rb
CHANGED
@@ -213,8 +213,6 @@ module Cnvrg
|
|
213
213
|
body = response.read_body
|
214
214
|
end
|
215
215
|
URLcrypt::key = [body].pack('H*')
|
216
|
-
puts "file_size: #{File.size(file_path).to_f}"
|
217
|
-
puts "start_time: #{Time.now}"
|
218
216
|
s3 = Aws::S3::Resource.new(
|
219
217
|
:access_key_id => URLcrypt.decrypt(upload_resp["result"]["sts_a"]),
|
220
218
|
:secret_access_key => URLcrypt.decrypt(upload_resp["result"]["sts_s"]),
|
@@ -223,7 +221,6 @@ module Cnvrg
|
|
223
221
|
resp = s3.bucket(URLcrypt.decrypt(upload_resp["result"]["bucket"])).
|
224
222
|
object(upload_resp["result"]["path"]+"/"+File.basename(file_path)).
|
225
223
|
upload_file(file_path,{:use_accelerate_endpoint=>true})
|
226
|
-
puts "end_time: #{Time.now}"
|
227
224
|
|
228
225
|
return resp
|
229
226
|
rescue =>e
|
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: 0.0.
|
4
|
+
version: 0.0.147
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yochay Ettun
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-04-
|
12
|
+
date: 2017-04-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|