cnvrg 0.0.1418 → 0.0.1420

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e5e43e32a2a764d0177be682b7957bdaa6c184b
4
- data.tar.gz: a1bd77092a713f3f6edb16f0f2bbb998d3a795d2
3
+ metadata.gz: f94403f39c98e7d4c89c32d9c066f6cc82bf9833
4
+ data.tar.gz: 2aa4bbda3018ee9d4615f343db4bbc4e420bfdd0
5
5
  SHA512:
6
- metadata.gz: f60c19507e5eed03dd015ec4d8d03694cf518692057ba969b64cc62a2208d50e02007ace23c0d82740ffe263f685271610ba58f87d22a6866c0bd2d4021ab54a
7
- data.tar.gz: 8049f800636d14a9de359dd580bece4a28cf6422304e65d17862e5aa85b83604aa9bf798c70b322c2bbcbafc6a40e3bf1659dbb6823d2050f044cd6b58468fef
6
+ metadata.gz: deab7e2a08f9e01744970c10641039cda7f56bd080d9cd6d0da49b1e2cd1c95e983c4b519a652f3ccf4d6aaf01c4cd074dba96140bce9a3adf06a2fb5bca7c3e
7
+ data.tar.gz: c8632b9c983025873f92ec07b64498c2625467c9a2e9593420cc9edf4d0c0f09278332d7a5dde58440b34c9e7e669f070804747fd6b4801787540af869b1b8be
@@ -115,7 +115,7 @@ class Thor
115
115
 
116
116
  def is_option (options, p)
117
117
  options.each do |o|
118
- if (!o.aliases.nil? and o.aliases[0].split(",").include? p) or o.switch_name.eql? p
118
+ if (!o.aliases.nil? and (o.aliases[0].split(",").include? p or o.aliases.include? p)) or o.switch_name.eql? p
119
119
  return o
120
120
  end
121
121
  end
@@ -2150,6 +2150,7 @@ module Cnvrg
2150
2150
 
2151
2151
  email_notification = options["email_notification"]
2152
2152
  upload_output = options["upload_output"]
2153
+ upload_output = "1m" if upload_output.nil? or upload_output.empty?
2153
2154
  time_to_upload = calc_output_time(upload_output)
2154
2155
  project_home = get_project_home
2155
2156
  @project = Project.new(project_home)
@@ -2195,7 +2196,7 @@ module Cnvrg
2195
2196
  start_commit = @project.last_local_commit
2196
2197
  cmd = cmd.join("\s")
2197
2198
 
2198
- say "Running: #{cmd}\n", Thor::Shell::Color::BLUE
2199
+
2199
2200
 
2200
2201
  @exp = Experiment.new(@project.owner, @project.slug)
2201
2202
 
@@ -2204,6 +2205,8 @@ module Cnvrg
2204
2205
  begin
2205
2206
  machine_activity = @exp.get_machine_activity(working_dir)
2206
2207
  @exp.start(cmd, platform, machine_name, start_commit, title, email_notification, machine_activity, script_path)
2208
+ say "Experiment's live results: #{Cnvrg::Helpers.remote_url}/#{@project.owner}/projects/#{@project.slug}/experiments/#{@exp.slug}", Thor::Shell::Color::GREEN
2209
+ say "Running: #{cmd}\n", Thor::Shell::Color::BLUE
2207
2210
  unless @exp.slug.nil?
2208
2211
  real = Time.now
2209
2212
  exp_success = true
@@ -2321,7 +2324,7 @@ module Cnvrg
2321
2324
 
2322
2325
  res = @exp.end(log, exit_status, end_commit, cpu_average, memory_average)
2323
2326
  check = Helpers.checkmark()
2324
- say "#{check} Done. Experiment's result: #{Cnvrg::Helpers.remote_url}/#{@project.owner}/projects/#{@project.slug}/experiments/#{@exp.slug}", Thor::Shell::Color::GREEN
2327
+ say "#{check} Done. Experiment's results were updated!", Thor::Shell::Color::GREEN
2325
2328
  log_end(0)
2326
2329
  end
2327
2330
  rescue => e
@@ -2691,17 +2694,27 @@ module Cnvrg
2691
2694
  end
2692
2695
 
2693
2696
  desc 'deploy', 'Deploys model to production'
2694
- method_option :machine_type, :type => :string, :aliases => ["--i", "-i"], :default => ""
2695
- method_option :schedule, :type => :string, :aliases => ["--s", "-s"], :default => ""
2696
- method_option :commit, :type => :string, :aliases => ["--c", "-c"], :default => ""
2697
+ method_option :small, :type => :boolean, :aliases => ["-sm", "--small"], :default => false
2698
+ method_option :medium, :type => :boolean, :aliases => ["-md", "--medium"], :default => false
2699
+ method_option :large, :type => :boolean, :aliases => ["-lg", "--large"], :default => false
2700
+ method_option :gpu, :type => :boolean, :aliases => ["--gpu"], :default => false
2701
+ method_option :gpuxl, :type => :boolean, :aliases => ["--gpuxl"], :default => false
2702
+ method_option :gpuxxl, :type => :boolean, :aliases => ["--gpuxxl"], :default => false
2703
+ method_option :schedule, :type => :string, :aliases => ["--schedule", "-s"], :default => ""
2704
+
2705
+ method_option :commit, :type => :string, :aliases => ["--commit", "-c"], :default => ""
2706
+ method_option :workers, :type => :string, :aliases => ["--workers", "-w"], :default => ""
2707
+ method_option :file_as_input, :type => :boolean, :aliases => ["--input", "-i"], :default => false
2697
2708
 
2698
2709
  def deploy(file_to_run, function)
2699
2710
  verify_logged_in(true)
2700
2711
  log_start(__method__, args, options)
2701
2712
  working_dir = is_cnvrg_dir
2702
2713
  begin
2714
+ instances = {"small" => options["small"], "medium" => options["medium"], "large" => options["large"],
2715
+ "gpu" => options["gpu"], "gpuxl" => options["gpuxl"], "gpuxxl" => options["gpuxxl"]}
2716
+ instance_type = get_instance_type(instances)
2703
2717
 
2704
- instance_type = options["machine_type"] || nil
2705
2718
  schedule = options["schedule"] || ""
2706
2719
 
2707
2720
 
@@ -2713,17 +2726,30 @@ module Cnvrg
2713
2726
  project = Project.new(working_dir)
2714
2727
  commit_to_run = options["commit"] || nil
2715
2728
 
2729
+ workers = options["workers"] || nil
2730
+ begin
2731
+ num_workers = workers.to_i
2732
+
2733
+ puts workers
2734
+ rescue
2735
+ say "Number of workers should be a number between 1 to 10", Thor::Shell::Color::RED
2736
+ exit(1)
2737
+ end
2738
+
2739
+ exit(0)
2740
+ file_as_input = options["file_as_input"] || false
2741
+
2716
2742
 
2717
2743
  image = is_project_with_docker(working_dir)
2718
2744
  if !image or !image.is_docker
2719
- say "Couldn't find image related to project", Thor::Shell::Color::RED
2720
- default = yes? "use cnvrg default image?", Thor::Shell::Color::YELLOW
2721
- if default
2722
- image = Images.new(working_dir, "cnvrg")
2723
- image_slug = image.image_slug
2724
- else
2725
- exit(0)
2726
- end
2745
+ # say "Couldn't find image related to project", Thor::Shell::Color::RED
2746
+ # default = yes? "use cnvrg default image?", Thor::Shell::Color::YELLOW
2747
+ # if default
2748
+ image = Images.new(working_dir, "cnvrg")
2749
+ image_slug = image.image_slug
2750
+ # else
2751
+ # exit(0)
2752
+ # end
2727
2753
  else
2728
2754
  image_slug = image.image_slug
2729
2755
  end
@@ -2731,7 +2757,7 @@ module Cnvrg
2731
2757
 
2732
2758
  invoke :sync, [false], []
2733
2759
 
2734
- res = project.deploy(file_to_run, function, nil, commit_to_run, instance_type, image_slug, schedule, local_timestamp)
2760
+ res = project.deploy(file_to_run, function, nil, commit_to_run, instance_type, image_slug, schedule, local_timestamp,num_workers,file_as_input)
2735
2761
 
2736
2762
  if Cnvrg::CLI.is_response_success(res)
2737
2763
 
@@ -3852,11 +3878,7 @@ module Cnvrg
3852
3878
  # container.start()
3853
3879
  command = ["/bin/bash", "-lc", "sudo echo -e \"#{login_content}\" >/home/ds/.netrc"]
3854
3880
  container.exec(command, tty: true)
3855
- command = ["/bin/bash", "-lc", "mkdir /home/ds/.cnvrg"]
3856
- container.exec(command, tty: true)
3857
- command = ["/bin/bash", "-lc", "mkdir /home/ds/.cnvrg/tmp"]
3858
- container.exec(command, tty: true)
3859
- command = ["/bin/bash", "-lc", "sudo chown -R ds /home/ds/.cnvrg /home/ds/.netrc"]
3881
+ command = ["/bin/bash", "-lc", "sudo chown -R ds:ds /home/ds/.netrc"]
3860
3882
  container.exec(command, tty: true)
3861
3883
  command = ["/bin/bash", "-lc", "sudo chmod 0600 /home/ds/.netrc"]
3862
3884
  container.exec(command, tty: true)
@@ -3875,7 +3897,7 @@ module Cnvrg
3875
3897
  end
3876
3898
 
3877
3899
  desc '', '', :hide => true
3878
- method_option :login, :type => :string, :aliases => ["-l", "--l"], :default => ""
3900
+ method_option :login, :type => :string, :aliases => ["-l"], :default => ""
3879
3901
 
3880
3902
  def config_flask_remote(image_name, port=80)
3881
3903
  local_images = Docker::Image.all
@@ -3908,16 +3930,50 @@ module Cnvrg
3908
3930
  container.start()
3909
3931
  command = ["/bin/bash", "-lc", "sudo echo -e \"#{login_content}\" >/home/ds/.netrc"]
3910
3932
  container.exec(command, tty: true)
3911
- command = ["/bin/bash", "-lc", "mkdir /home/ds/.cnvrg"]
3933
+ command = ["/bin/bash", "-lc", "sudo chown -R ds:ds /home/ds/.netrc"]
3912
3934
  container.exec(command, tty: true)
3913
- command = ["/bin/bash", "-lc", "mkdir /home/ds/.cnvrg/tmp"]
3935
+ command = ["/bin/bash", "-lc", "sudo chmod 0600 /home/ds/.netrc"]
3914
3936
  container.exec(command, tty: true)
3915
- command = ["/bin/bash", "-lc", "sudo chown -R ds /home/ds/.cnvrg /home/ds/.netrc"]
3937
+ say "#{container.id}:#{port}"
3938
+ rescue => e
3939
+ pus e
3940
+ if e.message.include? "is not running"
3941
+ return "port is taken"
3942
+ end
3943
+ puts "error"
3944
+ if container
3945
+ container.kill()
3946
+ end
3947
+ return false
3948
+ end
3949
+ end
3950
+
3951
+ desc '', '', :hide => true
3952
+ method_option :login, :type => :string, :aliases => ["-l"], :default => ""
3953
+
3954
+ def config_flask_remote_gpu(image_name, port=80)
3955
+ local_images = Docker::Image.all
3956
+
3957
+ docker_image_local = local_images.map { |x| x.info["RepoTags"] }.flatten.select { |y| y.eql? "#{image_name}:latest" }.flatten
3958
+ if docker_image_local.empty?
3959
+ say "no image"
3960
+ exit(1)
3961
+ end
3962
+
3963
+ begin
3964
+ login_content = options["login"]
3965
+ container_id = `nvidia-docker run -itd -p 80:80 -w /home/ds/app #{image_name}:latest /usr/local/cnvrg/start_super.sh`
3966
+ container_id = container_id.gsub("\n", "")
3967
+ container = Docker::Container.get(container_id)
3968
+ command = ["/bin/bash", "-lc", "sudo echo -e \"#{login_content}\" >/home/ds/.netrc"]
3969
+ container.exec(command, tty: true)
3970
+ command = ["/bin/bash", "-lc", "sudo chown -R ds:ds /home/ds/.netrc"]
3916
3971
  container.exec(command, tty: true)
3917
3972
  command = ["/bin/bash", "-lc", "sudo chmod 0600 /home/ds/.netrc"]
3918
3973
  container.exec(command, tty: true)
3919
3974
  say "#{container.id}:#{port}"
3920
3975
  rescue => e
3976
+ puts e
3921
3977
  if e.message.include? "is not running"
3922
3978
  return "port is taken"
3923
3979
  end
@@ -247,7 +247,7 @@ module Cnvrg
247
247
  python_version=`python --version > /dev/null 2>&1` ; is_python=$?.success?
248
248
  if is_python
249
249
 
250
- s4cmd=`pip freeze |grep s4cmd > /dev/null 2>&1` ; s4cmd_suc=$?.success?
250
+ s4cmd=`pip freeze 2>/dev/null |grep -e s4cmd -e boto3 > /dev/null 2>&1` ; s4cmd_suc=$?.success?
251
251
  if !s4cmd_suc
252
252
  `pip install s4cmd > /dev/null 2>&1` ; s4cmd_install_suc=$?.success?
253
253
  end
@@ -227,7 +227,7 @@ module Cnvrg
227
227
  python_version=`python --version > /dev/null 2>&1` ; is_python=$?.success?
228
228
  if is_python
229
229
 
230
- s4cmd=`pip freeze |grep s4cmd > /dev/null 2>&1` ; s4cmd_suc=$?.success?
230
+ s4cmd=`pip freeze 2>/dev/null |grep -e s4cmd -e boto3 > /dev/null 2>&1` ; s4cmd_suc=$?.success?
231
231
  if !s4cmd_suc
232
232
  `pip install s4cmd > /dev/null 2>&1` ; s4cmd_install_suc=$?.success?
233
233
  end
@@ -315,13 +315,14 @@ module Cnvrg
315
315
  return true
316
316
  end
317
317
 
318
- def deploy(file_to_run, function, input_params, commit_to_run, instance_type, image_slug, scheduling_query, local_timestamp)
318
+ def deploy(file_to_run, function, input_params, commit_to_run, instance_type, image_slug, scheduling_query, local_timestamp,workers, file_input)
319
319
  response = Cnvrg::API.request("users/#{@owner}/projects/#{@slug}/deploy", 'POST', {file_to_run: file_to_run, function: function,
320
320
  image_slug: image_slug, input_params: input_params,
321
321
  commit_sha1: commit_to_run,
322
322
  instance_type: instance_type,
323
323
  scheduling_query: scheduling_query,
324
- local_timestamp: local_timestamp})
324
+ local_timestamp: local_timestamp,
325
+ workers:workers,file_input:file_input})
325
326
  return response
326
327
  end
327
328
 
@@ -1,4 +1,4 @@
1
1
  module Cnvrg
2
- VERSION = '0.0.1418'
2
+ VERSION = '0.0.1420'
3
3
  end
4
4
 
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.1418
4
+ version: 0.0.1420
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-06-07 00:00:00.000000000 Z
12
+ date: 2017-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler