cnvrg 0.0.148 → 0.0.149
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 +681 -161
- data/lib/cnvrg/data.rb +50 -6
- data/lib/cnvrg/datafiles.rb +143 -17
- data/lib/cnvrg/dataset.rb +97 -16
- data/lib/cnvrg/experiment.rb +3 -3
- data/lib/cnvrg/files.rb +11 -5
- data/lib/cnvrg/project.rb +17 -8
- data/lib/cnvrg/version.rb +1 -1
- metadata +2 -2
data/lib/cnvrg/experiment.rb
CHANGED
@@ -78,15 +78,15 @@ module Cnvrg
|
|
78
78
|
|
79
79
|
end
|
80
80
|
|
81
|
-
def exec_remote(command, commit_to_run, instance_type, image_slug,scheduling_query,local_timestamp, grid,path_to_cmd)
|
82
|
-
|
81
|
+
def exec_remote(command, commit_to_run, instance_type, image_slug,scheduling_query,local_timestamp, grid,path_to_cmd,data, data_commit)
|
83
82
|
response = Cnvrg::API.request("users/#{@owner}/projects/#{@project_slug}/experiment/remote", 'POST', {command: command, image_slug: image_slug,
|
84
83
|
commit_sha1: commit_to_run,
|
85
84
|
instance_type: instance_type,
|
86
85
|
scheduling_query:scheduling_query,
|
87
86
|
local_timestamp:local_timestamp,
|
88
87
|
grid: grid,
|
89
|
-
path_to_cmd:path_to_cmd
|
88
|
+
path_to_cmd:path_to_cmd,dataset_slug:data,
|
89
|
+
dataset_commit: data_commit})
|
90
90
|
return response
|
91
91
|
end
|
92
92
|
|
data/lib/cnvrg/files.rb
CHANGED
@@ -206,7 +206,7 @@ module Cnvrg
|
|
206
206
|
|
207
207
|
end
|
208
208
|
|
209
|
-
def
|
209
|
+
def upload_large_files_s3(upload_resp, file_path)
|
210
210
|
begin
|
211
211
|
sts_path = upload_resp["result"]["path_sts"]
|
212
212
|
s4cmd_path = upload_resp["result"]["path_s4cmd"]
|
@@ -225,6 +225,14 @@ module Cnvrg
|
|
225
225
|
URLcrypt::key = [body].pack('H*')
|
226
226
|
|
227
227
|
python_version=`python --version > /dev/null 2>&1` ; is_python=$?.success?
|
228
|
+
if is_python
|
229
|
+
|
230
|
+
s4cmd=`pip freeze |grep s4cmd > /dev/null 2>&1` ; s4cmd_suc=$?.success?
|
231
|
+
if !s4cmd_suc
|
232
|
+
`pip install s4cmd > /dev/null 2>&1`
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
228
236
|
if !is_python
|
229
237
|
s3 = Aws::S3::Resource.new(
|
230
238
|
:access_key_id => URLcrypt.decrypt(upload_resp["result"]["sts_a"]),
|
@@ -245,7 +253,6 @@ module Cnvrg
|
|
245
253
|
response = http.request s4cmd_request
|
246
254
|
s4cmd_body = response.read_body
|
247
255
|
end
|
248
|
-
|
249
256
|
s4cmd_new_body = s4cmd_body.gsub(" self.client = self.boto3.client('s3',
|
250
257
|
aws_access_key_id=aws_access_key_id,
|
251
258
|
aws_secret_access_key=aws_secret_access_key)"," self.client = self.boto3.client('s3',
|
@@ -253,6 +260,7 @@ module Cnvrg
|
|
253
260
|
aws_secret_access_key='#{URLcrypt.decrypt(upload_resp["result"]["sts_s"])}',
|
254
261
|
aws_session_token='#{URLcrypt.decrypt(upload_resp["result"]["sts_st"])}')")
|
255
262
|
|
263
|
+
|
256
264
|
tmp = Tempfile.new('s4cmd.py')
|
257
265
|
tmp << s4cmd_new_body
|
258
266
|
tmp.flush
|
@@ -261,8 +269,7 @@ module Cnvrg
|
|
261
269
|
is_success = false
|
262
270
|
count = 0
|
263
271
|
while !is_success and count <3
|
264
|
-
|
265
|
-
resp = `python #{tmp.path} --max-singlepart-upload-size=#{MULTIPART_SPLIT} put -f #{file_path} s3://#{URLcrypt.decrypt(upload_resp["result"]["bucket"])}/#{upload_resp["result"]["path"]+"/"+File.basename(file_path)} > /dev/null 2>&1`
|
272
|
+
resp = `python #{tmp.path} --num-threads=128 --max-singlepart-upload-size=#{MULTIPART_SPLIT} put -f #{file_path} s3://#{URLcrypt.decrypt(upload_resp["result"]["bucket"])}/#{upload_resp["result"]["path"]+"/"+File.basename(file_path)} > /dev/null 2>&1`
|
266
273
|
is_success =$?.success?
|
267
274
|
count +=1
|
268
275
|
|
@@ -277,7 +284,6 @@ module Cnvrg
|
|
277
284
|
if File.exist? tmp
|
278
285
|
FileUtils.rm_rf [tmp]
|
279
286
|
end
|
280
|
-
puts e
|
281
287
|
return false
|
282
288
|
|
283
289
|
end
|
data/lib/cnvrg/project.rb
CHANGED
@@ -30,12 +30,14 @@ module Cnvrg
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def update_ignore_list(new_ignore)
|
33
|
-
if new_ignore.empty?
|
33
|
+
if new_ignore.nil? or new_ignore.empty?
|
34
34
|
return true
|
35
35
|
end
|
36
|
+
list = new_ignore.split(",")
|
36
37
|
begin
|
37
38
|
File.open(self.local_path+"/.cnvrgignore", "a+") do |f|
|
38
|
-
|
39
|
+
f.puts("\n")
|
40
|
+
list.each do |i|
|
39
41
|
f.puts("#{i}\n")
|
40
42
|
end
|
41
43
|
end
|
@@ -49,13 +51,18 @@ module Cnvrg
|
|
49
51
|
ignore_list = []
|
50
52
|
File.open(self.local_path+"/.cnvrgignore", "r").each_line do |line|
|
51
53
|
line = line.strip
|
52
|
-
if line.start_with? "#"
|
54
|
+
if line.start_with? "#" or ignore_list.include? line or line.empty?
|
53
55
|
next
|
54
56
|
end
|
55
|
-
if line.end_with? "/"
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
if line.end_with? "/" or File.directory?(line)
|
58
|
+
if line.end_with? "/"
|
59
|
+
ignore_list << line.chop
|
60
|
+
else
|
61
|
+
ignore_list << line
|
62
|
+
end
|
63
|
+
all_sub = Dir.glob("#{line}/**/*", File::FNM_DOTMATCH).flatten
|
64
|
+
|
65
|
+
ignore_list << all_sub.flatten
|
59
66
|
else
|
60
67
|
ignore_list << line
|
61
68
|
end
|
@@ -72,7 +79,6 @@ module Cnvrg
|
|
72
79
|
else
|
73
80
|
|
74
81
|
list_dirs = [project_name,
|
75
|
-
project_name + "/data",
|
76
82
|
project_name + "/models",
|
77
83
|
project_name + "/notebooks",
|
78
84
|
project_name + "/src",
|
@@ -242,15 +248,18 @@ module Cnvrg
|
|
242
248
|
list_ignore = self.get_ignore_list()
|
243
249
|
list.each do |e|
|
244
250
|
label = e.gsub(self.local_path + "/", "")
|
251
|
+
|
245
252
|
if File.directory? e
|
246
253
|
if list_ignore.include? label
|
247
254
|
next
|
248
255
|
end
|
256
|
+
|
249
257
|
tree_idx[label+"/"] = nil
|
250
258
|
else
|
251
259
|
if list_ignore.include? label
|
252
260
|
next
|
253
261
|
end
|
262
|
+
|
254
263
|
sha1 = Digest::SHA1.file(e).hexdigest
|
255
264
|
if old_idx.nil? or old_idx.to_h[:tree].nil?
|
256
265
|
tree_idx[label] = {sha1: sha1, commit_time: 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: 0.0.
|
4
|
+
version: 0.0.149
|
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-05-
|
12
|
+
date: 2017-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|