cnvrg 0.0.15 → 0.0.140

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.
data/lib/cnvrg/helpers.rb CHANGED
@@ -72,7 +72,7 @@ module Cnvrg
72
72
 
73
73
  def cnvrgignore_content
74
74
  %{
75
- # cnvrg ignore: Ignore the following directories and files
75
+ # cnvrg ignore: Ignore the following directories and files
76
76
  # for example:
77
77
  # some_dir/
78
78
  # some_file.txt
@@ -81,47 +81,6 @@ module Cnvrg
81
81
  }.strip
82
82
  end
83
83
 
84
- def hyper_content
85
- %{# Hyperparameter Optimization is the process of choosing a set of parameters for a learning algorithm, usually with the goal of optimizing a measure of the algorithm's performance on an independent data set.
86
-
87
- # Below is the list of parameters that will be used in the optimization process. Each parameter has a param_name that should match the argument that is feeded to the experiment s.t kernel => --kernel='rbf'
88
-
89
- parameters:
90
- # Integer parameter is a range of possible values between a minimum (inclusive)
91
- # and maximum (not inclusive) values. Values are floored (0.7 => 0)
92
- - param_name: "learning_rate"
93
- type: "integer"
94
- min: 0 # inclusive
95
- max: 10 # not inclusive
96
- scale: "linear"
97
- steps: 4 # The number of linear steps to produce.
98
-
99
-
100
- # Float parameter is a range of possible values between a minimum (inclusive)
101
- # and maximum (not inclusive) values.
102
- #
103
- - param_name: "learning_rate"
104
- type: "float" # precision is 9 after period
105
- min: 0.00001
106
- max: 0.1
107
- scale: "log2" # Could be log10 as well
108
- steps: 2
109
-
110
- # Discrete parameter is an array of numerical values.
111
- #
112
- - param_name: "c"
113
- type: "discrete"
114
- values: [0, 0.1 ,0.001]
115
-
116
- # Categorical parameter is an array of string values
117
- #
118
- - param_name: "kernel"
119
- type: "categorical"
120
- values: ["linear", "poly", "rbf"]
121
-
122
- }
123
- end
124
-
125
84
  def readme_content
126
85
  %{
127
86
  # README
data/lib/cnvrg/job.rb CHANGED
@@ -31,6 +31,7 @@ class LogJob
31
31
  upload_file(file_path)
32
32
  return resp
33
33
  rescue =>e
34
+ puts e
34
35
  return false
35
36
 
36
37
  end
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
5
5
 
6
6
  RemoteURL ||= "https://cnvrg.io"
7
7
 
@@ -12,7 +12,6 @@ module Cnvrg
12
12
  @title = config[:project_name]
13
13
  @slug = config[:project_slug]
14
14
  @owner = config[:owner]
15
- @working_dir = project_home
16
15
  rescue => e
17
16
  end
18
17
 
@@ -24,21 +23,18 @@ module Cnvrg
24
23
  return idx[:commit]
25
24
  end
26
25
 
27
-
28
26
  def url
29
27
  url = Cnvrg::Helpers.remote_url
30
28
  "#{url}/#{self.owner}/projects/#{self.slug}"
31
29
  end
32
30
 
33
31
  def update_ignore_list(new_ignore)
34
- if new_ignore.nil? or new_ignore.empty?
32
+ if new_ignore.empty?
35
33
  return true
36
34
  end
37
- list = new_ignore.split(",")
38
35
  begin
39
36
  File.open(self.local_path+"/.cnvrgignore", "a+") do |f|
40
- f.puts("\n")
41
- list.each do |i|
37
+ new_ignore.each do |i|
42
38
  f.puts("#{i}\n")
43
39
  end
44
40
  end
@@ -52,18 +48,13 @@ module Cnvrg
52
48
  ignore_list = []
53
49
  File.open(self.local_path+"/.cnvrgignore", "r").each_line do |line|
54
50
  line = line.strip
55
- if line.start_with? "#" or ignore_list.include? line or line.empty?
51
+ if line.start_with? "#"
56
52
  next
57
53
  end
58
- if line.end_with? "/" or File.directory?(line)
59
- if line.end_with? "/"
60
- ignore_list << line.chop
61
- else
62
- ignore_list << line
63
- end
64
- all_sub = Dir.glob("#{line}/**/*", File::FNM_DOTMATCH).flatten
65
-
66
- ignore_list << all_sub.flatten
54
+ if line.end_with? "/"
55
+ ignore_list << line.chop
56
+ sub_dirs = Dir.glob("#{line}/**/*").each { |x| x.gsub!("//", "/") }
57
+ ignore_list << sub_dirs.flatten
67
58
  else
68
59
  ignore_list << line
69
60
  end
@@ -80,6 +71,7 @@ module Cnvrg
80
71
  else
81
72
 
82
73
  list_dirs = [project_name,
74
+ project_name + "/data",
83
75
  project_name + "/models",
84
76
  project_name + "/notebooks",
85
77
  project_name + "/src",
@@ -97,7 +89,6 @@ module Cnvrg
97
89
  ]
98
90
  cnvrgreadme = Helpers.readme_content
99
91
  cnvrgignore = Helpers.cnvrgignore_content
100
- cnvrghyper = Helpers.hyper_content
101
92
 
102
93
  begin
103
94
 
@@ -117,8 +108,6 @@ module Cnvrg
117
108
  File.open(project_name + "/.cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
118
109
  File.open(project_name + "/.cnvrgignore", "w+") { |f| f.write cnvrgignore }
119
110
  File.open(project_name + "/README.md", "w+") { |f| f.write cnvrgreadme }
120
- File.open(project_name + "/src/hyper.yaml", "w+") { |f| f.write cnvrghyper }
121
-
122
111
  rescue
123
112
  return false
124
113
  end
@@ -147,13 +136,14 @@ module Cnvrg
147
136
  FileUtils.mkdir_p list_dirs
148
137
  FileUtils.touch list_files
149
138
  File.open(".cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
150
- File.open(".cnvrgignore", "w+") { |f| f.write cnvrgignore } unless File.exist? ".cnvrgignore"
139
+ File.open(".cnvrgignore", "w+") { |f| f.write cnvrgignore }
151
140
  if !File.exist? "README" and !File.exist? "README.md"
152
141
  FileUtils.touch [ "README.md" ]
153
142
  File.open("README.md", "w+") { |f| f.write cnvrgreadme }
154
143
  end
155
144
 
156
145
  rescue => e
146
+ puts e
157
147
  return false
158
148
  end
159
149
  return true
@@ -215,26 +205,6 @@ module Cnvrg
215
205
  end
216
206
  return true
217
207
  end
218
- def update_is_new_branch(new_branch)
219
- config = YAML.load_file(@working_dir+"/.cnvrg/config.yml")
220
- config[:new_branch] = new_branch
221
- File.open(@working_dir+"/.cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
222
- end
223
- def get_new_branch
224
- begin
225
- config = YAML.load_file(@working_dir+"/.cnvrg/config.yml")
226
- return config[:new_branch]
227
- rescue =>e
228
- return false
229
-
230
- end
231
- end
232
-
233
- def remove_new_branch
234
- config = YAML.load_file(@working_dir+"/.cnvrg/config.yml")
235
- new_config = config.except(:new_branch)
236
- File.open(@working_dir+"/.cnvrg/config.yml", "w+") { |f| f.write new_config.to_yaml }
237
- end
238
208
 
239
209
  def generate_idx
240
210
  if File.exists? "#{self.local_path}/.cnvrg/idx.yml"
@@ -249,18 +219,15 @@ module Cnvrg
249
219
  list_ignore = self.get_ignore_list()
250
220
  list.each do |e|
251
221
  label = e.gsub(self.local_path + "/", "")
252
-
253
222
  if File.directory? e
254
223
  if list_ignore.include? label
255
224
  next
256
225
  end
257
-
258
226
  tree_idx[label+"/"] = nil
259
227
  else
260
228
  if list_ignore.include? label
261
229
  next
262
230
  end
263
-
264
231
  sha1 = Digest::SHA1.file(e).hexdigest
265
232
  if old_idx.nil? or old_idx.to_h[:tree].nil?
266
233
  tree_idx[label] = {sha1: sha1, commit_time: nil}
@@ -291,7 +258,7 @@ module Cnvrg
291
258
 
292
259
  local_idx = self.generate_idx
293
260
  response = Cnvrg::API.request("users/#{self.owner}/projects/#{self.slug}/status", 'POST', {idx: local_idx, new_branch: new_branch, current_commit: commit})
294
- CLI.is_response_success(response,false)
261
+ CLI.is_response_success(response)
295
262
  return response
296
263
  end
297
264
 
@@ -300,8 +267,7 @@ module Cnvrg
300
267
  commit = last_local_commit
301
268
  end
302
269
  response = Cnvrg::API.request("users/#{self.owner}/projects/#{self.slug}/commit/compare", 'POST', {current_commit: commit})
303
- CLI.is_response_success(response,false)
304
- update_is_new_branch(response["result"]["new_branch"])
270
+ CLI.is_response_success(response)
305
271
  return response["result"]["new_branch"]
306
272
  end
307
273
 
@@ -316,22 +282,16 @@ module Cnvrg
316
282
  return true
317
283
  end
318
284
 
319
- def deploy(file_to_run, function, input_params, commit_to_run, instance_type, image_slug, scheduling_query, local_timestamp,workers, file_input)
285
+ def deploy(file_to_run, function, input_params, commit_to_run, instance_type, image_slug, scheduling_query, local_timestamp)
320
286
  response = Cnvrg::API.request("users/#{@owner}/projects/#{@slug}/deploy", 'POST', {file_to_run: file_to_run, function: function,
321
287
  image_slug: image_slug, input_params: input_params,
322
288
  commit_sha1: commit_to_run,
323
289
  instance_type: instance_type,
324
290
  scheduling_query: scheduling_query,
325
- local_timestamp: local_timestamp,
326
- workers:workers,file_input:file_input})
291
+ local_timestamp: local_timestamp})
327
292
  return response
328
293
  end
329
- def list_commits
330
- response = Cnvrg::API.request("users/#{self.owner}/projects/#{self.slug}/commits/list", 'GET')
331
- CLI.is_response_success(response)
332
- return response
333
294
 
334
- end
335
295
  def update_idx_with_commit!(commit)
336
296
  idx_hash = YAML.load_file("#{self.local_path}/.cnvrg/idx.yml")
337
297
  idx_hash[:commit] = commit
data/lib/cnvrg/version.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  module Cnvrg
2
- VERSION = '0.0.15'
3
-
2
+ VERSION = '0.0.140'
4
3
  end
5
4
 
data/lib/cnvrg.rb CHANGED
@@ -3,5 +3,6 @@ require 'cnvrg/version'
3
3
  require 'cnvrg/cli'
4
4
  require 'thor'
5
5
 
6
+
6
7
  module Cnvrg
7
8
  end
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.15
4
+ version: 0.0.140
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-07-16 00:00:00.000000000 Z
12
+ date: 2017-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -249,74 +249,46 @@ dependencies:
249
249
  name: logstash-logger
250
250
  requirement: !ruby/object:Gem::Requirement
251
251
  requirements:
252
- - - "~>"
252
+ - - ">="
253
253
  - !ruby/object:Gem::Version
254
- version: 0.22.1
254
+ version: '0'
255
255
  type: :runtime
256
256
  prerelease: false
257
257
  version_requirements: !ruby/object:Gem::Requirement
258
258
  requirements:
259
- - - "~>"
259
+ - - ">="
260
260
  - !ruby/object:Gem::Version
261
- version: 0.22.1
261
+ version: '0'
262
262
  - !ruby/object:Gem::Dependency
263
263
  name: launchy
264
264
  requirement: !ruby/object:Gem::Requirement
265
265
  requirements:
266
- - - "~>"
266
+ - - ">="
267
267
  - !ruby/object:Gem::Version
268
- version: '2.4'
268
+ version: '0'
269
269
  type: :runtime
270
270
  prerelease: false
271
271
  version_requirements: !ruby/object:Gem::Requirement
272
272
  requirements:
273
- - - "~>"
273
+ - - ">="
274
274
  - !ruby/object:Gem::Version
275
- version: '2.4'
275
+ version: '0'
276
276
  - !ruby/object:Gem::Dependency
277
277
  name: docker-api
278
278
  requirement: !ruby/object:Gem::Requirement
279
279
  requirements:
280
- - - "~>"
280
+ - - ">="
281
281
  - !ruby/object:Gem::Version
282
- version: '1.33'
282
+ version: '0'
283
283
  type: :runtime
284
284
  prerelease: false
285
285
  version_requirements: !ruby/object:Gem::Requirement
286
286
  requirements:
287
- - - "~>"
287
+ - - ">="
288
288
  - !ruby/object:Gem::Version
289
- version: '1.33'
289
+ version: '0'
290
290
  - !ruby/object:Gem::Dependency
291
291
  name: rubyzip
292
- requirement: !ruby/object:Gem::Requirement
293
- requirements:
294
- - - "~>"
295
- - !ruby/object:Gem::Version
296
- version: '1.2'
297
- type: :runtime
298
- prerelease: false
299
- version_requirements: !ruby/object:Gem::Requirement
300
- requirements:
301
- - - "~>"
302
- - !ruby/object:Gem::Version
303
- version: '1.2'
304
- - !ruby/object:Gem::Dependency
305
- name: activesupport
306
- requirement: !ruby/object:Gem::Requirement
307
- requirements:
308
- - - "~>"
309
- - !ruby/object:Gem::Version
310
- version: '5.0'
311
- type: :runtime
312
- prerelease: false
313
- version_requirements: !ruby/object:Gem::Requirement
314
- requirements:
315
- - - "~>"
316
- - !ruby/object:Gem::Version
317
- version: '5.0'
318
- - !ruby/object:Gem::Dependency
319
- name: ruby-progressbar
320
292
  requirement: !ruby/object:Gem::Requirement
321
293
  requirements:
322
294
  - - ">="
@@ -330,7 +302,7 @@ dependencies:
330
302
  - !ruby/object:Gem::Version
331
303
  version: '0'
332
304
  - !ruby/object:Gem::Dependency
333
- name: net-ssh
305
+ name: activesupport
334
306
  requirement: !ruby/object:Gem::Requirement
335
307
  requirements:
336
308
  - - ">="
@@ -358,16 +330,12 @@ files:
358
330
  - lib/cnvrg/api.rb
359
331
  - lib/cnvrg/auth.rb
360
332
  - lib/cnvrg/cli.rb
361
- - lib/cnvrg/data.rb
362
- - lib/cnvrg/datafiles.rb
363
- - lib/cnvrg/dataset.rb
364
333
  - lib/cnvrg/experiment.rb
365
334
  - lib/cnvrg/files.rb
366
335
  - lib/cnvrg/helpers.rb
367
336
  - lib/cnvrg/job.rb
368
337
  - lib/cnvrg/project.rb
369
338
  - lib/cnvrg/runner.rb
370
- - lib/cnvrg/ssh.rb
371
339
  - lib/cnvrg/version.rb
372
340
  homepage: https://cnvrg.io
373
341
  licenses: []
@@ -388,8 +356,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
388
356
  version: '0'
389
357
  requirements: []
390
358
  rubyforge_project:
391
- rubygems_version: 2.6.12
359
+ rubygems_version: 2.5.1
392
360
  signing_key:
393
361
  specification_version: 4
394
362
  summary: A CLI tool for interacting with cnvrg.io.
395
363
  test_files: []
364
+ has_rdoc:
data/lib/cnvrg/data.rb DELETED
@@ -1,72 +0,0 @@
1
- require 'cnvrg/cli'
2
- require 'thor'
3
- class SubCommandBase < Thor
4
- def self.banner(command, namespace = nil, subcommand = false)
5
- "#{basename} #{command.usage}"
6
- end
7
-
8
- def self.subcommand_prefix
9
- self.name.gsub(%r{.*::}, '').gsub(%r{^[A-Z]}) { |match| match[0].downcase }.gsub(%r{[A-Z]}) { |match| "-#{match[0].downcase}" }
10
- end
11
- end
12
-
13
- module Cnvrg
14
-
15
- class Data < SubCommandBase
16
- class_option :no_compression, :type => :boolean, :aliases => ["-nc", "--no_compression"], :default => false
17
- desc "data init", "init data folder"
18
- method_option :public, :type => :boolean, :aliases => ["-p", "--public"], :default => false
19
- def init
20
- cli = Cnvrg::CLI.new()
21
- public = options["public"]
22
- cli.init_data(public)
23
- end
24
- desc "data upload", "upload data folder"
25
- method_option :ignore, :type => :array, :aliases => ["-i", "--i"], :desc => "ignore following files"
26
- method_option :verbose, :type => :boolean, :aliases => ["-v"], :default => false
27
- method_option :sync, :type => :boolean, :aliases => ["-s"], :default => false
28
- method_option :no_compression, :type => :boolean, :aliases => ["-nc", "--no_compression"], :default => false
29
-
30
- def upload
31
- cli = Cnvrg::CLI.new()
32
- ignore = options["ignore"]
33
- verbose = options["verbose"]
34
- sync = options["sync"]
35
- no_compression = options["no_compression"]
36
- cli.upload_data_tar(ignore, verbose,sync,no_compression)
37
- end
38
- desc 'data download', 'pull data'
39
- method_option :verbose, :type => :boolean, :aliases => ["-v"], :default => false
40
- method_option :sync, :type => :boolean, :aliases => ["-s"], :default => false
41
-
42
- def download()
43
- cli = Cnvrg::CLI.new()
44
- verbose = options["verbose"]
45
- sync = options["sync"]
46
-
47
- cli.download_data(verbose,sync,Dir.pwd)
48
-
49
- end
50
- desc 'data clone', 'clone datset'
51
- def clone(dataset_url)
52
- cli = Cnvrg::CLI.new()
53
- cli.clone_data(dataset_url)
54
-
55
- end
56
- desc 'data list', 'list of datasets'
57
- def list()
58
- cli = Cnvrg::CLI.new()
59
-
60
- cli.list_dataset()
61
-
62
- end
63
- desc 'data commits', 'pull data'
64
-
65
- def commits()
66
- cli = Cnvrg::CLI.new()
67
- cli.list_dataset_commits()
68
-
69
- end
70
-
71
- end
72
- end