cnvrg 0.0.1425 → 0.0.1426
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 +76 -10
- data/lib/cnvrg/dataset.rb +2 -0
- data/lib/cnvrg/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bac7148a22a0afab03e2aff2051a5153fd02ba92
|
4
|
+
data.tar.gz: 769b6e2f773a9b1a907c9030caf3731dde8c944b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d13f7de09b107fc38c5c7948613a4e3137bfff2e8ff2ca02e60902a08720b51c07dad4aa4e9cd38421966559802ad1fe20f5f80c0baca01cc5f436e2030c9fce
|
7
|
+
data.tar.gz: dc65d935cbab883a70a2242bbead6151765d7431e91ed641a9e78b2f642c3227e6717fb44e479bf0475109f1b7fde84d4664ba6e50719a6a80330d8aedbe1338
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -203,12 +203,16 @@ module Cnvrg
|
|
203
203
|
end
|
204
204
|
config = YAML.load_file(home_dir+"/.cnvrg/config.yml")
|
205
205
|
owner = config.to_h[:owner]
|
206
|
+
compression_path = "#{File.expand_path('~')}/.cnvrg/tmp"
|
206
207
|
|
207
208
|
say "Setting default api to be: #{url}", Thor::Shell::Color::BLUE
|
208
209
|
if config.empty?
|
209
|
-
config = {owner: "", username: "", version_last_check: get_start_day(), api: url}
|
210
|
+
config = {owner: "", username: "", version_last_check: get_start_day(), api: url,compression_path: compression_path }
|
210
211
|
else
|
211
|
-
|
212
|
+
if !config.to_h[:compression_path].nil?
|
213
|
+
compression_path = config.to_h[:compression_path]
|
214
|
+
end
|
215
|
+
config = {owner: config.to_h[:owner], username: config.to_h[:username], version_last_check: config.to_h[:version_last_check], api: url, compression_path: compression_path}
|
212
216
|
end
|
213
217
|
res = Cnvrg::API.request("/users/#{owner}/custom_api", 'POST', {custom_api: url})
|
214
218
|
if Cnvrg::CLI.is_response_success(res,false)
|
@@ -244,7 +248,9 @@ module Cnvrg
|
|
244
248
|
FileUtils.touch [home_dir+"/.cnvrg/config.yml"]
|
245
249
|
end
|
246
250
|
config = YAML.load_file(home_dir+"/.cnvrg/config.yml")
|
247
|
-
|
251
|
+
|
252
|
+
compression_path = "#{home_dir}/.cnvrg/tmp"
|
253
|
+
config = {owner: owner, username: current_user, version_last_check: get_start_day(), api: url,compression_path:compression_path}
|
248
254
|
File.open(home_dir+"/.cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
|
249
255
|
say "Done"
|
250
256
|
rescue
|
@@ -319,7 +325,40 @@ module Cnvrg
|
|
319
325
|
end
|
320
326
|
end
|
321
327
|
|
322
|
-
|
328
|
+
desc 'set_compression_path', 'set compression path'
|
329
|
+
method_option :reset, :type => :boolean, :aliases => ["-r","--reset"], :default => false
|
330
|
+
|
331
|
+
def set_compression_path(*compression_path)
|
332
|
+
begin
|
333
|
+
if (compression_path.nil? or compression_path.empty?) and options["reset"]
|
334
|
+
compression_path = ["#{File.expand_path('~')}/.cnvrg/tmp"]
|
335
|
+
end
|
336
|
+
compression_path = compression_path.join(" ")
|
337
|
+
if !Dir.exist? compression_path
|
338
|
+
say "Couldn't find #{compression_path}, please make sure it exist", Thor::Shell::Color::RED
|
339
|
+
exit(0)
|
340
|
+
end
|
341
|
+
|
342
|
+
home_dir = File.expand_path('~')
|
343
|
+
path = "#{home_dir}/.cnvrg/config.yml"
|
344
|
+
if !File.exist?(path)
|
345
|
+
say "Couldn't find ~/.cnvrg/config.yml file, please logout and login again", Thor::Shell::Color::RED
|
346
|
+
|
347
|
+
exit(0)
|
348
|
+
end
|
349
|
+
config = YAML.load_file(path)
|
350
|
+
config_new = {owner: config.to_h[:owner], username: config.to_h[:username],
|
351
|
+
version_last_check: config.to_h[:version_last_check], api: config.to_h[:api], compression_path: compression_path}
|
352
|
+
File.open(home_dir+"/.cnvrg/config.yml", "w+") { |f| f.write config_new.to_yaml }
|
353
|
+
checks = Helpers.checkmark
|
354
|
+
say "#{checks} Done", Thor::Shell::Color::GREEN
|
355
|
+
|
356
|
+
rescue SignalException
|
357
|
+
say "\nAborting"
|
358
|
+
exit(1)
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
323
362
|
|
324
363
|
|
325
364
|
desc 'login', 'Authenticate with cnvrg.io platform'
|
@@ -1182,7 +1221,8 @@ module Cnvrg
|
|
1182
1221
|
say "Compressing data", Thor::Shell::Color::BLUE
|
1183
1222
|
|
1184
1223
|
home_dir = File.expand_path('~')
|
1185
|
-
|
1224
|
+
compression_path = get_compression_path
|
1225
|
+
tar_path = "#{compression_path}#{@dataset.slug}_#{commit_sha1}.tar.gz"
|
1186
1226
|
tar_files_path = "#{home_dir}/.cnvrg/tmp/#{@dataset.slug}_#{commit_sha1}.txt"
|
1187
1227
|
tar_files = (result["added"] + result["updated_on_local"]).join("\n")
|
1188
1228
|
File.open(tar_files_path, 'w') { |f| f.write tar_files }
|
@@ -1546,6 +1586,8 @@ module Cnvrg
|
|
1546
1586
|
if result["added"].size > 0
|
1547
1587
|
FileUtils.rm_rf(result["added"])
|
1548
1588
|
end
|
1589
|
+
say "Changes were removed successfully", Thor::Shell::Color::GREEN
|
1590
|
+
|
1549
1591
|
|
1550
1592
|
rescue SignalException
|
1551
1593
|
log_end(-1)
|
@@ -2152,7 +2194,6 @@ module Cnvrg
|
|
2152
2194
|
method_option :data, :type => :string, :aliases => ["-d", "--data"], :default => ""
|
2153
2195
|
method_option :data_commit, :type => :string, :aliases => ["-dc", "--data_commit"], :default => ""
|
2154
2196
|
method_option :ignore, :type => :string, :aliases => ["-i", "--ignore"], :desc => "ignore following files", :default => ""
|
2155
|
-
|
2156
2197
|
def exec(*cmd)
|
2157
2198
|
|
2158
2199
|
log = []
|
@@ -2580,7 +2621,8 @@ module Cnvrg
|
|
2580
2621
|
method_option :data_commit, :type => :string, :aliases => ["--data_commit"], :default => ""
|
2581
2622
|
method_option :ignore, :type => :string, :aliases => ["-i", "--ignore"], :desc => "ignore following files", :default => ""
|
2582
2623
|
|
2583
|
-
def
|
2624
|
+
def
|
2625
|
+
exec_remote(*cmd)
|
2584
2626
|
verify_logged_in(true)
|
2585
2627
|
log_start(__method__, args, options)
|
2586
2628
|
working_dir = is_cnvrg_dir
|
@@ -3905,7 +3947,7 @@ module Cnvrg
|
|
3905
3947
|
# },
|
3906
3948
|
# }
|
3907
3949
|
|
3908
|
-
container_id = `nvidia-docker run -itd -p #{port}:8888 -p #{tensport}:6006 -w #{app_dir} #{image_name}:latest #{cmd} `
|
3950
|
+
container_id = `nvidia-docker run -itd -p #{port}:8888 -p #{tensport}:6006 -w #{app_dir} -v /usr/bin/nvidia-smi:/usr/bin/nvidia-smi #{image_name}:latest #{cmd} `
|
3909
3951
|
container_id = container_id.gsub("\n", "")
|
3910
3952
|
container = Docker::Container.get(container_id)
|
3911
3953
|
# container.start()
|
@@ -4402,7 +4444,13 @@ module Cnvrg
|
|
4402
4444
|
if url.nil? or url.empty?
|
4403
4445
|
url = "https://cnvrg.io/api"
|
4404
4446
|
end
|
4405
|
-
config =
|
4447
|
+
config = YAML.load_file(home_dir+"/.cnvrg/config.yml")
|
4448
|
+
|
4449
|
+
compression_path = "#{home_dir}/.cnvrg/tmp"
|
4450
|
+
if !config.empty? and !config.to_h[:compression_path].nil?
|
4451
|
+
compression_path = config.to_h[:compression_path]
|
4452
|
+
end
|
4453
|
+
config = {owner: owner, username: username, version_last_check: get_start_day(), api: url,compression_path:compression_path}
|
4406
4454
|
|
4407
4455
|
File.open(home_dir+"/.cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
|
4408
4456
|
return true
|
@@ -4510,6 +4558,19 @@ module Cnvrg
|
|
4510
4558
|
api = config.to_h[:api]
|
4511
4559
|
return api.gsub!("/api", "")
|
4512
4560
|
end
|
4561
|
+
def get_compression_path
|
4562
|
+
home_dir = File.expand_path('~')
|
4563
|
+
|
4564
|
+
config = YAML.load_file(home_dir+ "/.cnvrg/config.yml")
|
4565
|
+
compression_path = config.to_h[:compression_path]
|
4566
|
+
if compression_path.nil?
|
4567
|
+
compression_path = "#{home_dir}/.cnvrg/tmp/"
|
4568
|
+
end
|
4569
|
+
if !compression_path.ends_with? "/"
|
4570
|
+
compression_path = compression_path + "/"
|
4571
|
+
end
|
4572
|
+
return compression_path
|
4573
|
+
end
|
4513
4574
|
|
4514
4575
|
def get_project_home
|
4515
4576
|
absolute_path = Dir.pwd
|
@@ -4859,7 +4920,12 @@ module Cnvrg
|
|
4859
4920
|
|
4860
4921
|
def create_tar(path_in, path_out, tar_files)
|
4861
4922
|
#The cd is meant for cases when running cnvrg data uplaod not in the main folder
|
4862
|
-
|
4923
|
+
begin
|
4924
|
+
`cd #{path_in} && tar -czf #{path_out} -T #{tar_files}`
|
4925
|
+
rescue => e
|
4926
|
+
puts "Exception while compressing data: #{e.message}"
|
4927
|
+
end
|
4928
|
+
|
4863
4929
|
return $?.success?
|
4864
4930
|
end
|
4865
4931
|
|
data/lib/cnvrg/dataset.rb
CHANGED
@@ -116,6 +116,7 @@ module Cnvrg
|
|
116
116
|
File.open(".cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
|
117
117
|
File.open(".cnvrgignore", "w+") { |f| f.write cnvrgignore } unless File.exist? ".cnvrgignore"
|
118
118
|
rescue => e
|
119
|
+
"Exception in init data: #{e.message}"
|
119
120
|
return false
|
120
121
|
end
|
121
122
|
return true
|
@@ -141,6 +142,7 @@ module Cnvrg
|
|
141
142
|
File.open("#{dataset_name}/.cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
|
142
143
|
File.open("#{dataset_name}/.cnvrgignore", "w+") { |f| f.write cnvrgignore } unless File.exist? ".cnvrgignore"
|
143
144
|
rescue => e
|
145
|
+
puts "Exception in clone request:#{e.message}"
|
144
146
|
return false
|
145
147
|
end
|
146
148
|
return true
|
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.1426
|
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-
|
12
|
+
date: 2017-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -373,8 +373,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
373
373
|
version: '0'
|
374
374
|
requirements: []
|
375
375
|
rubyforge_project:
|
376
|
-
rubygems_version: 2.
|
376
|
+
rubygems_version: 2.5.1
|
377
377
|
signing_key:
|
378
378
|
specification_version: 4
|
379
379
|
summary: A CLI tool for interacting with cnvrg.io.
|
380
380
|
test_files: []
|
381
|
+
has_rdoc:
|