cnvrg 2.0.6 → 2.0.11

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
  SHA256:
3
- metadata.gz: b238ce877c0fa8da80c63c6d3d165ce974c250ea9c3f3d21ff092098356aa5a5
4
- data.tar.gz: 7c7b4aa637b3bcaf5f18a7eb973d6995f0f1e25147a16a2ccfb1ce3d6dea91e3
3
+ metadata.gz: 86857e06a0d107172c161467e8ff8cb04a120d8b230c97843e91ce13c826ccce
4
+ data.tar.gz: 272fe88e1e390f2887c36c49915cc89f10a6cf9947bb98ab6fd503476ac03820
5
5
  SHA512:
6
- metadata.gz: fb1b724199e92fddfa2be4c04b9eb1a8a94e1df65759482fb6c3173f7c3c7632d236c22836749e5f1d6578115555b838285b58d1a95a42ce2df67d3a354da043
7
- data.tar.gz: c840826e01dcd8061fdb1bf065f416d97ca3fe35575649171814741c32332b458c7bac57fa248e9afd45f337b60b18003077cc72d5927527490689572608ad6b
6
+ metadata.gz: c28ab54953e47843897273f8038f5e0bfc92e101e161d1edae4477250e1334b5730b5020713572ad2482c5b0c305c5c0b2c5725b8796a44c06750eccf2924e9f
7
+ data.tar.gz: 69be0cd1fc89180ce7b878aaa8e0767b5be9a00cb0c9813c504e62677c1c839831aa6cf4fbf27aeb66aa50b756f7b28f46eb721182e588bcc4b7c65544e6a41b
data/Readme.md CHANGED
@@ -39,4 +39,18 @@
39
39
  * DEV-10189 - Bug: CLI Sync -file/folder with broken symlink will cause sync to fail
40
40
  ## Version v2.0.6
41
41
  2021-07-18
42
- * DEV-10209 - Bug: some experiments in grid failed on cnvrg-cli commands (docker container id was missing)
42
+ * DEV-10209 - Bug: some experiments in grid failed on cnvrg-cli commands (docker container id was missing)
43
+ ## Version v2.0.7
44
+ 2021-07-27
45
+ * DEV-10186 - Bug: CLI/run an experiment with --local tag giver server error
46
+ ## Version v2.0.8
47
+ 2021-09-06
48
+ * DEV-10697 - Bug: Tensorboard not starting in workspace and experiment.
49
+ ## Version v2.0.9
50
+ 2021-09-12
51
+ * DEV-10502 - Bug: Periodic sync stuck
52
+ ## Version v2.0.10
53
+ 2021-09-12
54
+ * DEV-10502 - Bug: Periodic sync stuck
55
+ ## Version v2.0.11
56
+ 2021-10-21
@@ -1,7 +1,7 @@
1
1
  module Cnvrg
2
2
  class LibraryCli < SubCommandBase
3
-
4
- desc "library import", ''
3
+ map push: :import
4
+ desc "library push", 'Push a new library to AI Library'
5
5
  def import
6
6
  unless File.exists? "library.yml"
7
7
  Cnvrg::CLI.log_message("Can't find library.yml", 'red')
data/lib/cnvrg/cli.rb CHANGED
@@ -3147,7 +3147,7 @@ module Cnvrg
3147
3147
  invoke :exec, [cmd], :sync_before => sync_before, :sync_after => sync_after, :title => title,
3148
3148
  :log => log, :email_notification => email_notification, :upload_output => upload_output,
3149
3149
  :commit => commit, :image => image, :data => data, :data_commit => data_commit,
3150
- :ignore => ignore, :force => force, :output_dir=>output_dir, :data_query=>data_query
3150
+ :ignore => ignore, :force => force, :output_dir=>output_dir, :data_query=>data_query, :local => local
3151
3151
  return
3152
3152
  end
3153
3153
  else
@@ -3204,6 +3204,7 @@ module Cnvrg
3204
3204
  method_option :data_query, :type => :string, :aliases => ["-q", "--query"], :default => nil
3205
3205
  method_option :use_bash, :type => :boolean, :aliases => ["-b", "--use_bash"], :default => false
3206
3206
  method_option :docker_stats, :type => :boolean, :aliases => ["--docker_stats"], :default => true
3207
+ method_option :local, :type => :boolean, :aliases => ["-l", "--local"], :default => false
3207
3208
 
3208
3209
  def exec(*cmd)
3209
3210
  log = []
@@ -3228,6 +3229,7 @@ module Cnvrg
3228
3229
  project_home = get_project_home
3229
3230
  data_query = options["data_query"]
3230
3231
  docker_stats = options["docker_stats"]
3232
+ local = options[:local] || false
3231
3233
  @project = Project.new(project_home)
3232
3234
  if @project.is_git
3233
3235
  sync_before = false
@@ -3323,43 +3325,49 @@ module Cnvrg
3323
3325
  if @exp.get_cmd.present?
3324
3326
  cmd = @exp.get_cmd
3325
3327
  end
3326
- command_slug = (0...18).map { (65 + rand(26)).chr }.join
3327
- result_file = "/conf/result-#{command_slug}"
3328
- data = {cmd: cmd, async: true, format: true, file_name: result_file, use_script: true, use_bash: options["use_bash"]}
3329
-
3330
- conn = Cnvrg::Helpers::Executer.get_main_conn
3331
- response = conn.post('command', data.to_json)
3332
- if response.to_hash[:status].to_i != 200
3333
- exit_status = 129
3334
- raise StandardError.new("Cant send command to slave")
3335
- end
3336
- t = FileWatch::Tail.new
3337
- filename = result_file
3338
- lines = []
3339
- t.tail(filename)
3340
- t.subscribe do |path, line|
3341
- begin
3342
- cur_log = JSON.parse(line)
3343
- if cur_log["type"] == "endMessage"
3344
- exit_status = cur_log["real"].to_i
3345
- break
3346
- else
3347
- puts(cur_log.to_json)
3348
- STDOUT.flush
3349
- cur_log["time"] = Time.parse(cur_log["timestamp"])
3350
- cur_log["message"] = cur_log["message"].to_s + "\r\n"
3351
- log << cur_log
3352
- end
3353
- if log.size >= 10
3354
- @exp.upload_temp_log(log)
3355
- log = []
3356
- elsif (start_time + 15.seconds) <= Time.now
3357
- @exp.upload_temp_log(log) unless log.empty?
3358
- log = []
3359
- start_time = Time.now
3328
+
3329
+ if local
3330
+ exec_local(cmd)
3331
+ exit_status = $?.exitstatus
3332
+
3333
+ else
3334
+ command_slug = (0...18).map { (65 + rand(26)).chr }.join
3335
+ result_file = "/conf/result-#{command_slug}"
3336
+ data = {cmd: cmd, async: true, format: true, file_name: result_file, use_script: true, use_bash: options["use_bash"]}
3337
+ conn = Cnvrg::Helpers::Executer.get_main_conn
3338
+ response = conn.post('command', data.to_json)
3339
+ if response.to_hash[:status].to_i != 200
3340
+ exit_status = 129
3341
+ raise StandardError.new("Cant send command to slave")
3342
+ end
3343
+ t = FileWatch::Tail.new
3344
+ filename = result_file
3345
+ lines = []
3346
+ t.tail(filename)
3347
+ t.subscribe do |path, line|
3348
+ begin
3349
+ cur_log = JSON.parse(line)
3350
+ if cur_log["type"] == "endMessage"
3351
+ exit_status = cur_log["real"].to_i
3352
+ break
3353
+ else
3354
+ puts(cur_log.to_json)
3355
+ STDOUT.flush
3356
+ cur_log["time"] = Time.parse(cur_log["timestamp"])
3357
+ cur_log["message"] = cur_log["message"].to_s + "\r\n"
3358
+ log << cur_log
3359
+ end
3360
+ if log.size >= 10
3361
+ @exp.upload_temp_log(log)
3362
+ log = []
3363
+ elsif (start_time + 15.seconds) <= Time.now
3364
+ @exp.upload_temp_log(log) unless log.empty?
3365
+ log = []
3366
+ start_time = Time.now
3367
+ end
3368
+ rescue => e
3369
+ log_error(e)
3360
3370
  end
3361
- rescue => e
3362
- log_error(e)
3363
3371
  end
3364
3372
  end
3365
3373
  end_time = Time.now
@@ -5007,7 +5015,7 @@ module Cnvrg
5007
5015
  end
5008
5016
  end
5009
5017
 
5010
- desc 'experiments', 'List project experiments'
5018
+ desc 'experiments', 'List project experiments', :hide => true
5011
5019
  method_option :id, :type => :string, :aliases => ["--id"], :desc => "Get info for specific experiments", :default => ""
5012
5020
  method_option :tag, :type => :string, :aliases => ["-t"], :desc => "Get info for specific experiment tag", :default => ""
5013
5021
 
@@ -5876,6 +5884,56 @@ module Cnvrg
5876
5884
  end
5877
5885
  end
5878
5886
 
5887
+ def exec_local(cmd)
5888
+ PTY.spawn(@exp.as_env, cmd) do |stdout, stdin, pid, stderr|
5889
+ begin
5890
+ stdout.each do |line|
5891
+ cur_time = Time.now
5892
+ real_time = Time.now - real
5893
+ cur_log = {time: cur_time,
5894
+ message: line,
5895
+ type: "stdout",
5896
+ real: real_time
5897
+ }
5898
+ if print_log
5899
+ puts({log: line, timestamp: Time.now, exp_logs: true}.to_json)
5900
+ end
5901
+ log << cur_log
5902
+ if log.size >= 10
5903
+ @exp.upload_temp_log(log) unless log.empty?
5904
+ log = []
5905
+ elsif (start_time + 15.seconds) <= Time.now
5906
+ @exp.upload_temp_log(log) unless log.empty?
5907
+ log = []
5908
+ start_time = Time.now
5909
+ end
5910
+ end
5911
+ if stderr
5912
+ stderr.each do |err|
5913
+ log << {time: Time.now, message: err, type: "stderr"}
5914
+ end
5915
+ end
5916
+ rescue Errno::EIO => e
5917
+ log_error(e)
5918
+ if !log.empty?
5919
+ temp_log = log
5920
+ @exp.upload_temp_log(temp_log) unless temp_log.empty?
5921
+ log -= temp_log
5922
+ end
5923
+ rescue Errno::ENOENT => e
5924
+ exp_success = false
5925
+ log_message("command \"#{cmd}\" couldn't be executed, verify command is valid", Thor::Shell::Color::RED)
5926
+ log_error(e)
5927
+ rescue => e
5928
+ res = @exp.end(log, 1, start_commit, 0, 0)
5929
+ log_message("Error occurred,aborting", Thor::Shell::Color::RED)
5930
+ log_error(e)
5931
+ exit(0)
5932
+ end
5933
+ ::Process.wait pid
5934
+ end
5935
+ end
5936
+
5879
5937
  end
5880
5938
  end
5881
5939
 
data/lib/cnvrg/project.rb CHANGED
@@ -661,7 +661,11 @@ module Cnvrg
661
661
 
662
662
  def fetch_webapp_slugs(webapp_slug, slugs: nil)
663
663
  response = Cnvrg::API_V2.request("#{self.owner}/projects/#{self.slug}/webapps/#{webapp_slug}" , 'GET')
664
- return response["experiments"]
664
+
665
+ if response.key?("experiments")
666
+ return response["experiments"]
667
+ end
668
+ return response["data"]["attributes"]["experiments"]
665
669
  rescue
666
670
  slugs
667
671
  end
data/lib/cnvrg/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cnvrg
2
- VERSION = '2.0.6'
2
+ VERSION = '2.0.11'
3
3
  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: 2.0.6
4
+ version: 2.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yochay Ettun
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-07-20 00:00:00.000000000 Z
13
+ date: 2021-10-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler