cnvrg 1.6.0.1 → 1.6.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 689273a5f98807ad5a58f7bd13c64afe7524c57bf7cd5a53041cb072dff1976a
4
- data.tar.gz: f404ae18536e6f7e43b4d0b9b342ed7e7e64250bf427efa0017488bfb08677c7
3
+ metadata.gz: 7d86069ef477a0e9e5d05eb754caa0cd025f97c4eeb43640b89494e5ff966d95
4
+ data.tar.gz: e2c315c26dbc155ed538d1992cd0833d01f6cdb0f714d4c4dbba0bd7482446d3
5
5
  SHA512:
6
- metadata.gz: c2114fb5d5de328e8ea7df2892a40be729e86707d507a4c462ea560acdc6eb6b552bf720a3d48f1b6dad341dbca66bc3988b0ae5030bdaabc0e69d16ea785ac1
7
- data.tar.gz: 99b6e69acc9c4399720a18c1b561050828e8f4e47b6ced70ae6c10434ecade93f858b7a4ee4df09c8668f0eb6893d9ed6e3bc883c4d3c28512a13a2ad561ddaf
6
+ metadata.gz: 2baa36b55fc4cea10cdde2a69c2144d13331301efce03477563fb900b59fd1b4a6a5c4ade0bef5176515537243291b01cda2a6b073e507e2a98fe3feb27a94f1
7
+ data.tar.gz: 91b217fe795cae96230bc40e3b1a107368ed1c00a67492ea195c237ae50d1f6c8700922357fb399c7dac6eeb1188d8a3150c65ab0a2c2c6640b79dd2928d5b23
@@ -2976,7 +2976,8 @@ module Cnvrg
2976
2976
  else
2977
2977
  invoke :exec, [cmd], :sync_before => sync_before, :sync_after => sync_after, :title => title,
2978
2978
  :log => log, :email_notification => email_notification, :upload_output => upload_output,
2979
- :commit => commit, :image => image, :data => data, :data_commit => data_commit, :ignore => ignore, :force => force, :output_dir=>output_dir, :data_query=>data_query
2979
+ :commit => commit, :image => image, :data => data, :data_commit => data_commit,
2980
+ :ignore => ignore, :force => force, :output_dir=>output_dir, :data_query=>data_query
2980
2981
  return
2981
2982
  end
2982
2983
  else
@@ -5108,6 +5109,61 @@ module Cnvrg
5108
5109
 
5109
5110
  end
5110
5111
 
5112
+
5113
+ desc 'compare-experiments', 'compare experiments using tensorboard', :hide => true
5114
+ method_option :slugs, :type => :string, :aliases => ["-ids"], :desc => "List of experiments slugs to compare"
5115
+ method_option :namespace, :type => :string, :aliases => ["-n"], :desc => "experiments pods namespace", :default => "cnvrg"
5116
+ method_option :project_slug, :type => :string, :aliases => ["-s"], :desc => "project slug"
5117
+ method_option :project_owner, :type => :string, :aliases => ["-o"], :desc => "project slug"
5118
+ method_option :frequency, :type => :numeric, :aliases => ["-f"], :desc => "poll frequency"
5119
+
5120
+ def compare_experiments
5121
+ verify_logged_in(true)
5122
+ log_start(__method__, args, options)
5123
+ exps_map = {}
5124
+
5125
+ if options[:slugs].blank?
5126
+ log_message("No experiments slugs given", Thor::Shell::Color::RED)
5127
+ return false
5128
+ end
5129
+ slugs = options[:slugs].split(",")
5130
+ if slugs.blank?
5131
+ log_message("No experiments slugs given", Thor::Shell::Color::RED)
5132
+ return false
5133
+ end
5134
+ frequency = options[:frequency] || 5
5135
+ namespace = options[:namespace]
5136
+ project_dir = is_cnvrg_dir(Dir.pwd)
5137
+ @project = Project.new(project_home=project_dir, slug: options[:project_slug], owner: options[:project_owner])
5138
+
5139
+ while true
5140
+ slugs.each do |exp_slug|
5141
+
5142
+ begin
5143
+ if exps_map[exp_slug].blank?
5144
+ exp = @project.get_experiment(exp_slug)["experiment"]
5145
+ else
5146
+ exp = exps_map[exp_slug]
5147
+ log_message("#{exp["title"]} has ended skipping it", Thor::Shell::Color::BLUE)
5148
+ next
5149
+ end
5150
+ exp_name = exp["title"]
5151
+ if exp["end_commit"].present? and exp["status"] != "Ongoing"
5152
+ log_message("#{exp_name} has ended, getting files from end commit", Thor::Shell::Color::BLUE)
5153
+ Cnvrg::Helpers.get_experiment_events_log_from_server(exp, @project)
5154
+ exps_map[exp_slug] = exp
5155
+ elsif exp["machine_activity"].present?
5156
+ log_message("#{exp_name} is running should get logs", Thor::Shell::Color::BLUE)
5157
+ Cnvrg::Helpers.get_experiment_events_log_via_kubectl(exp, namespace)
5158
+ end
5159
+ rescue => e
5160
+ Cnvrg::Logger.log_error(e)
5161
+ end
5162
+ end
5163
+ sleep frequency
5164
+ end
5165
+ end
5166
+
5111
5167
  desc 'experiments', 'List project experiments'
5112
5168
  method_option :id, :type => :string, :aliases => ["--id"], :desc => "Get info for specific experiments", :default => ""
5113
5169
  method_option :tag, :type => :string, :aliases => ["-t"], :desc => "Get info for specific experiment tag", :default => ""
@@ -359,5 +359,56 @@ parameters:
359
359
  return {client: client, key: key, iv: iv, bucket: bucket, upload_options: upload_options}
360
360
  end
361
361
 
362
+ def get_experiment_events_log_from_server(exp, project)
363
+ dest_dir = exp["slug"]
364
+ commit = exp["end_commit"]
365
+ response = project.clone(0, commit)
366
+ Cnvrg::CLI.is_response_success(response, should_exit=false)
367
+ commit_sha1 = response["result"]["commit"]
368
+ files = response["result"]["tree"].keys
369
+ files = files.select do |f| f.include?("tfevents") end
370
+ @files = Cnvrg::Files.new(project.owner, project.slug, project_home: "", project: project)
371
+ @files.download_files(files, commit_sha1, progress: nil)
372
+ FileUtils.rm_rf("#{dest_dir}")
373
+ FileUtils.mkdir_p(dest_dir)
374
+ files.each do |f|
375
+ FileUtils.mv(f, "#{dest_dir}/#{File.basename(f)}")
376
+ end
377
+ end
378
+
379
+ def get_experiment_events_log_via_kubectl(exp, namespace)
380
+ dest_dir = exp["slug"]
381
+ result = `kubectl -n #{namespace} get pods | grep #{exp["machine_activity"]}`
382
+ pod_name = result.split(" ")[0]
383
+ if pod_name.present?
384
+ FileUtils.mkdir_p(dest_dir)
385
+ working_dir = `kubectl -n #{namespace} exec #{pod_name} -- pwd`
386
+ working_dir.strip!
387
+ res = `kubectl -n #{namespace} exec #{pod_name} -- /bin/bash -c "ls -R #{working_dir}"`
388
+ files_and_folders = res.split("\n\n")
389
+ all_files = []
390
+
391
+ files_and_folders.each do |file_and_folder|
392
+ files = file_and_folder.split("\n")
393
+ if files.first.include?(":")
394
+ folder = files.first.gsub(":", "")
395
+ files = files.drop(1)
396
+ end
397
+ files.each do |file|
398
+ if file.include?("tfevents")
399
+ all_files << "#{folder}/#{file}"
400
+ end
401
+ end
402
+ end
403
+
404
+ all_files.each do |file|
405
+ res = `kubectl -n #{namespace} cp #{pod_name}:#{file} #{dest_dir}/#{File.basename(file)}`
406
+ end
407
+
408
+ end
409
+ rescue => e
410
+ Cnvrg::Logger.log_error(e)
411
+ end
362
412
  end
413
+
363
414
  end
@@ -79,7 +79,7 @@ module Cnvrg
79
79
  end
80
80
  post_build_update(true)
81
81
  rescue => e
82
- @cli.log_message("Image Build failed: #{e.message}")
82
+ @cli.log_message("Image Build failed")
83
83
  post_build_update(false, e.message)
84
84
  end
85
85
 
@@ -1,4 +1,4 @@
1
1
  module Cnvrg
2
- VERSION = '1.6.0.1'
2
+ VERSION = '1.6.0.2'
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: 1.6.0.1
4
+ version: 1.6.0.2
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: 2019-10-28 00:00:00.000000000 Z
13
+ date: 2019-11-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler