cnvrg 0.5.0 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/cnvrg.gemspec +2 -3
- data/lib/cnvrg/api.rb +4 -4
- data/lib/cnvrg/cli.rb +430 -117
- data/lib/cnvrg/data.rb +42 -5
- data/lib/cnvrg/datafiles.rb +118 -4
- data/lib/cnvrg/dataset.rb +100 -4
- data/lib/cnvrg/experiment.rb +26 -8
- data/lib/cnvrg/helpers.rb +1 -1
- data/lib/cnvrg/project.rb +37 -18
- data/lib/cnvrg/version.rb +1 -1
- metadata +6 -20
data/lib/cnvrg/helpers.rb
CHANGED
data/lib/cnvrg/project.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
module Cnvrg
|
3
3
|
class Project
|
4
|
-
attr_reader :slug, :owner, :title, :local_path, :working_dir
|
4
|
+
attr_reader :slug, :owner, :title, :local_path, :working_dir, :is_git
|
5
5
|
|
6
6
|
RemoteURL ||= "https://cnvrg.io"
|
7
7
|
IDXParallelThreads ||= 15
|
@@ -9,12 +9,13 @@ module Cnvrg
|
|
9
9
|
|
10
10
|
def initialize(project_home)
|
11
11
|
begin
|
12
|
-
config = YAML.load_file(project_home+"/.cnvrg/config.yml")
|
13
12
|
@local_path = project_home
|
13
|
+
@working_dir = project_home
|
14
|
+
config = YAML.load_file(project_home+"/.cnvrg/config.yml")
|
14
15
|
@title = config[:project_name]
|
15
16
|
@slug = config[:project_slug]
|
16
17
|
@owner = config[:owner]
|
17
|
-
@
|
18
|
+
@is_git = config[:git] || false
|
18
19
|
rescue => e
|
19
20
|
end
|
20
21
|
|
@@ -170,7 +171,7 @@ module Cnvrg
|
|
170
171
|
return true
|
171
172
|
end
|
172
173
|
|
173
|
-
def self.link(owner, project_name,
|
174
|
+
def self.link(owner, project_name, docker=false, git = false)
|
174
175
|
ignore_exits = File.exist? ".cnvrgignore"
|
175
176
|
list_dirs = [".cnvrg"
|
176
177
|
]
|
@@ -192,7 +193,8 @@ module Cnvrg
|
|
192
193
|
|
193
194
|
config = {project_name: project_name,
|
194
195
|
project_slug: project_slug,
|
195
|
-
owner: owner
|
196
|
+
owner: owner,
|
197
|
+
git: git}
|
196
198
|
FileUtils.mkdir_p list_dirs
|
197
199
|
FileUtils.touch list_files
|
198
200
|
File.open(".cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
|
@@ -209,7 +211,7 @@ module Cnvrg
|
|
209
211
|
return true
|
210
212
|
end
|
211
213
|
|
212
|
-
def self.clone_dir(project_slug, project_owner, project_name)
|
214
|
+
def self.clone_dir(project_slug, project_owner, project_name,is_git=false)
|
213
215
|
list_dirs = [project_name,
|
214
216
|
project_name + "/.cnvrg"
|
215
217
|
]
|
@@ -217,19 +219,20 @@ module Cnvrg
|
|
217
219
|
|
218
220
|
list_files = [
|
219
221
|
project_name + "/.cnvrg/config.yml",
|
220
|
-
|
222
|
+
project_name+"/.cnvrgignore",
|
221
223
|
]
|
222
224
|
begin
|
223
225
|
config = {project_name: project_name,
|
224
226
|
project_slug: project_slug,
|
225
|
-
owner: project_owner
|
227
|
+
owner: project_owner,
|
228
|
+
git: is_git}
|
226
229
|
FileUtils.mkdir_p list_dirs
|
227
230
|
FileUtils.touch list_files
|
228
|
-
|
231
|
+
cnvrgignore = Helpers.cnvrgignore_content
|
229
232
|
|
230
233
|
|
231
234
|
File.open(project_name + "/.cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
|
232
|
-
|
235
|
+
File.open(project_name+"/.cnvrgignore", "w+") { |f| f.write cnvrgignore }
|
233
236
|
|
234
237
|
rescue
|
235
238
|
return false
|
@@ -257,28 +260,38 @@ module Cnvrg
|
|
257
260
|
end
|
258
261
|
end
|
259
262
|
|
260
|
-
def self.clone_dir_remote(project_slug, project_owner, project_name)
|
263
|
+
def self.clone_dir_remote(project_slug, project_owner, project_name,is_git=false)
|
261
264
|
list_dirs = [
|
262
265
|
".cnvrg"
|
263
266
|
]
|
264
267
|
|
265
268
|
|
266
|
-
|
269
|
+
|
270
|
+
list_files = [
|
267
271
|
".cnvrg/config.yml",
|
268
|
-
# ".cnvrgignore",
|
269
272
|
|
270
273
|
]
|
271
|
-
|
274
|
+
|
275
|
+
|
276
|
+
begin
|
272
277
|
config = {project_name: project_name,
|
273
278
|
project_slug: project_slug,
|
274
|
-
owner: project_owner
|
279
|
+
owner: project_owner,
|
280
|
+
git: is_git
|
281
|
+
}
|
275
282
|
FileUtils.mkdir_p list_dirs
|
276
283
|
FileUtils.touch list_files
|
277
|
-
# cnvrgignore = Helpers.cnvrgignore_content
|
278
284
|
|
279
285
|
|
280
286
|
File.open(".cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
|
281
|
-
|
287
|
+
if !File.exist? ".cnvrgignore"
|
288
|
+
FileUtils.touch ".cnvrgignore"
|
289
|
+
list_files << ".cnvrgignore"
|
290
|
+
cnvrgignore = Helpers.cnvrgignore_content
|
291
|
+
File.open(".cnvrgignore", "w+") { |f| f.write cnvrgignore }
|
292
|
+
|
293
|
+
|
294
|
+
end
|
282
295
|
|
283
296
|
rescue
|
284
297
|
return false
|
@@ -310,11 +323,12 @@ module Cnvrg
|
|
310
323
|
if File.exists? "#{self.local_path}/.cnvrg/idx.yml"
|
311
324
|
old_idx = YAML.load_file("#{self.local_path}/.cnvrg/idx.yml")
|
312
325
|
else
|
326
|
+
|
313
327
|
old_idx = nil
|
314
328
|
end
|
315
329
|
|
316
330
|
tree_idx = Hash.new(0)
|
317
|
-
list = Dir.glob("#{self.local_path}/**/*", File::FNM_DOTMATCH).reject { |x| (x =~ /\/\.{1,2}$/) or (x =~ /^#{self.local_path}\/\.cnvrg\/*/) or (x =~/^#{self.local_path}\/\.cnvrgignore.conflict*/) and not (x =~/^#{self.local_path}\/\.cnvrgignore/) }
|
331
|
+
list = Dir.glob("#{self.local_path}/**/*", File::FNM_DOTMATCH).reject { |x| (x =~ /\/\.{1,2}$/) or (x =~ /^#{self.local_path}\/\.cnvrg\/*/) or (x =~ /^#{self.local_path}\/\.git\/*/) or (x =~/^#{self.local_path}\/\.cnvrgignore.conflict*/) and not (x =~/^#{self.local_path}\/\.cnvrgignore/) }
|
318
332
|
list_ignore = self.get_ignore_list()
|
319
333
|
if deploy
|
320
334
|
list_ignore << ["main.py","main.pyc", "__init__.py", "uwsgi.ini"]
|
@@ -355,6 +369,11 @@ module Cnvrg
|
|
355
369
|
response = Cnvrg::API.request("users/#{self.owner}/projects/#{self.slug}/clone", 'POST', {project_slug: self.slug, remote: remote, commit: commit})
|
356
370
|
return response
|
357
371
|
end
|
372
|
+
def git_download_commit(commit)
|
373
|
+
response = Cnvrg::API.request("users/#{self.owner}/projects/#{self.slug}/git_download_commit", 'POST', {commit_sha1: commit})
|
374
|
+
CLI.is_response_success(response,true)
|
375
|
+
return response
|
376
|
+
end
|
358
377
|
|
359
378
|
def compare_idx(new_branch, commit:last_local_commit,force:false, deploy: false, in_exp:false, specific_files: [])
|
360
379
|
if commit.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.5.
|
4
|
+
version: 0.5.5
|
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: 2018-
|
12
|
+
date: 2018-07-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -121,14 +121,14 @@ dependencies:
|
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: 0.15.2
|
125
125
|
type: :runtime
|
126
126
|
prerelease: false
|
127
127
|
version_requirements: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
131
|
+
version: 0.15.2
|
132
132
|
- !ruby/object:Gem::Dependency
|
133
133
|
name: netrc
|
134
134
|
requirement: !ruby/object:Gem::Requirement
|
@@ -335,14 +335,14 @@ dependencies:
|
|
335
335
|
requirements:
|
336
336
|
- - "~>"
|
337
337
|
- !ruby/object:Gem::Version
|
338
|
-
version:
|
338
|
+
version: 5.2.0
|
339
339
|
type: :runtime
|
340
340
|
prerelease: false
|
341
341
|
version_requirements: !ruby/object:Gem::Requirement
|
342
342
|
requirements:
|
343
343
|
- - "~>"
|
344
344
|
- !ruby/object:Gem::Version
|
345
|
-
version:
|
345
|
+
version: 5.2.0
|
346
346
|
- !ruby/object:Gem::Dependency
|
347
347
|
name: ruby-progressbar
|
348
348
|
requirement: !ruby/object:Gem::Requirement
|
@@ -385,20 +385,6 @@ dependencies:
|
|
385
385
|
- - ">="
|
386
386
|
- !ruby/object:Gem::Version
|
387
387
|
version: '0'
|
388
|
-
- !ruby/object:Gem::Dependency
|
389
|
-
name: faraday_middleware-request-retry
|
390
|
-
requirement: !ruby/object:Gem::Requirement
|
391
|
-
requirements:
|
392
|
-
- - ">="
|
393
|
-
- !ruby/object:Gem::Version
|
394
|
-
version: '0'
|
395
|
-
type: :runtime
|
396
|
-
prerelease: false
|
397
|
-
version_requirements: !ruby/object:Gem::Requirement
|
398
|
-
requirements:
|
399
|
-
- - ">="
|
400
|
-
- !ruby/object:Gem::Version
|
401
|
-
version: '0'
|
402
388
|
description: A CLI tool for interacting with cnvrg.io.
|
403
389
|
email:
|
404
390
|
- info@cnvrg.io
|