cnvrg 1.6.0.1 → 1.6.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cnvrg/cli.rb +57 -1
- data/lib/cnvrg/helpers.rb +51 -0
- data/lib/cnvrg/image.rb +1 -1
- data/lib/cnvrg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d86069ef477a0e9e5d05eb754caa0cd025f97c4eeb43640b89494e5ff966d95
|
4
|
+
data.tar.gz: e2c315c26dbc155ed538d1992cd0833d01f6cdb0f714d4c4dbba0bd7482446d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2baa36b55fc4cea10cdde2a69c2144d13331301efce03477563fb900b59fd1b4a6a5c4ade0bef5176515537243291b01cda2a6b073e507e2a98fe3feb27a94f1
|
7
|
+
data.tar.gz: 91b217fe795cae96230bc40e3b1a107368ed1c00a67492ea195c237ae50d1f6c8700922357fb399c7dac6eeb1188d8a3150c65ab0a2c2c6640b79dd2928d5b23
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -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,
|
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 => ""
|
data/lib/cnvrg/helpers.rb
CHANGED
@@ -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
|
data/lib/cnvrg/image.rb
CHANGED
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: 1.6.0.
|
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-
|
13
|
+
date: 2019-11-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|