cnvrg 0.4.0 → 0.4.1.4
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 +4 -4
- data/lib/cnvrg/cli.rb +137 -230
- data/lib/cnvrg/experiment.rb +6 -1
- data/lib/cnvrg/files.rb +127 -1
- data/lib/cnvrg/helpers.rb +4 -1
- data/lib/cnvrg/project.rb +8 -5
- data/lib/cnvrg/result.rb +29 -0
- data/lib/cnvrg/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5feadd09ac750893368f8ce797dab118bb7b2b00
|
4
|
+
data.tar.gz: 2b1ecc2d4ac59d49dae305e86063bdf3cf78666f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b41e7bf46edf0a5fc7f6f111fa59769312412afebe55e497cb32522f87fb060f630767adae7959ebcac01959f6f100a464efc8364cd47078162c2794cd987100
|
7
|
+
data.tar.gz: 9e4aac7444147003fb95d65a44a4490b463e98b1897cfce86636330ca8af1686e629acec25ca6f345c32b70725fe328a4da09d87de2642b102a8578e71b48e74
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -22,6 +22,7 @@ require 'cnvrg/dataset'
|
|
22
22
|
require 'cnvrg/datafiles'
|
23
23
|
require 'cnvrg/data'
|
24
24
|
require 'cnvrg/ssh'
|
25
|
+
require 'cnvrg/result'
|
25
26
|
require 'logstash-logger'
|
26
27
|
require 'cnvrg/job'
|
27
28
|
require 'docker'
|
@@ -68,7 +69,6 @@ class Thor
|
|
68
69
|
stop_on_unknown = Thor.stop_on_unknown_option? config[:current_command]
|
69
70
|
opts = Thor::Options.new(parse_options, hash_options, stop_on_unknown)
|
70
71
|
real_options = []
|
71
|
-
|
72
72
|
real_args = [].replace(array_options)
|
73
73
|
if local_options.is_a? (Array) and !local_options.empty? and args.empty?
|
74
74
|
array_options.each_with_index do |p, i|
|
@@ -1579,52 +1579,47 @@ module Cnvrg
|
|
1579
1579
|
response = @project.clone(remote, commit_to_clone)
|
1580
1580
|
Cnvrg::CLI.is_response_success response
|
1581
1581
|
working_dir = project_home
|
1582
|
-
docker_image = response["result"]["image"]
|
1583
|
-
current_commit = response["result"]["commit"]
|
1584
1582
|
idx = {commit: response["result"]["commit"], tree: response["result"]["tree"]}
|
1585
1583
|
File.open(working_dir + "/.cnvrg/idx.yml", "w+") {|f| f.write idx.to_yaml}
|
1586
|
-
if !docker_image.nil? and !docker_image.empty? and !remote
|
1587
|
-
local_images = Docker::Image.all
|
1588
|
-
docker_image_local = local_images.map {|x| x.info["RepoTags"]}.flatten.select {|y| y.eql? "#{docker_image}:latest"}.flatten
|
1589
|
-
if docker_image_local.size == 0
|
1590
|
-
if yes? "Image wasn't found locally, pull image from cnvrg repository?", Thor::Shell::Color::YELLOW
|
1591
|
-
image = pull(docker_image)
|
1592
|
-
if image
|
1593
|
-
log_message("downloaded image: #{docker_image}", Thor::Shell::Color::BLUE)
|
1594
|
-
@image = Images.new(working_dir, docker_image)
|
1595
|
-
else
|
1596
|
-
log_message("Could not create a new project with docker, image was not found", Thor::Shell::Color::RED)
|
1597
|
-
@project.revert(working_dir)
|
1598
|
-
exit(1)
|
1599
|
-
end
|
1600
|
-
end
|
1601
1584
|
|
1602
|
-
|
1603
|
-
|
1604
|
-
@image = Images.new(working_dir, docker_image_local[0])
|
1605
|
-
elsif docker_image_local.size > 1
|
1606
|
-
log_message("found #{docker_image_local.size} images, choose the image name you want to use", Thor::Shell::Color::BLUE)
|
1607
|
-
image_name = ask "#{docker_image_local.join("\n")}\n", Thor::Shell::Color::BLUE
|
1608
|
-
@image = Images.new(working_dir, image_name)
|
1609
|
-
end
|
1585
|
+
log_message("Downloading files", Thor::Shell::Color::BLUE)
|
1586
|
+
files = response["result"]["files"]
|
1610
1587
|
|
1611
|
-
|
1588
|
+
if !files.nil?
|
1589
|
+
begin
|
1590
|
+
download_result = @files.download_multiple_files_s3(files, project_home)
|
1612
1591
|
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1592
|
+
rescue Interrupt
|
1593
|
+
log_message("Couldn't download, Rolling Back all changes.", Thor::Shell::Color::RED)
|
1594
|
+
|
1595
|
+
@files.revoke_clone(project_home)
|
1596
|
+
return
|
1597
|
+
end
|
1598
|
+
Project.verify_cnvrgignore_exist(project_name, remote)
|
1599
|
+
if !download_result.is_success?
|
1600
|
+
log_message(download_result.e_msg, download_result.msg_color, false)
|
1601
|
+
log_message(download_result.e_msg_backtrace, download_result.msg_color, false)
|
1602
|
+
|
1603
|
+
@files.revoke_clone(project_home)
|
1604
|
+
end
|
1605
|
+
log_message(download_result.msg, download_result.msg_color)
|
1606
|
+
else
|
1607
|
+
current_commit = response["result"]["commit"]
|
1608
|
+
if !response["result"]["tree"].nil?
|
1609
|
+
parallel_options = {
|
1610
|
+
:progress => {
|
1611
|
+
:title => "Download Progress",
|
1612
|
+
:progress_mark => '=',
|
1613
|
+
:format => "%b>>%i| %p%% %t",
|
1614
|
+
:starting_at => 0,
|
1615
|
+
:total => response["result"]["tree"].size,
|
1616
|
+
:autofinish => true
|
1617
|
+
},
|
1618
|
+
in_processes: ParallelProcesses,
|
1619
|
+
in_thread: ParallelThreads
|
1620
|
+
}
|
1627
1621
|
begin
|
1622
|
+
successful_changes =[]
|
1628
1623
|
is_success = true
|
1629
1624
|
clone_result = Parallel.map((response["result"]["tree"]), parallel_options) do |f|
|
1630
1625
|
|
@@ -1635,51 +1630,55 @@ module Cnvrg
|
|
1635
1630
|
f
|
1636
1631
|
successful_changes << relative_path
|
1637
1632
|
else
|
1638
|
-
is_success =
|
1633
|
+
is_success =false
|
1639
1634
|
log_message("Could not create directory: #{f[0]}", Thor::Shell::Color::RED)
|
1640
1635
|
raise Parallel::Kill
|
1641
1636
|
end
|
1642
1637
|
else
|
1643
1638
|
# blob
|
1644
1639
|
|
1645
|
-
if @files.download_file_s3(f[0], relative_path, project_home, commit_sha1
|
1640
|
+
if @files.download_file_s3(f[0], relative_path, project_home, commit_sha1=current_commit)
|
1646
1641
|
f
|
1647
1642
|
successful_changes << relative_path
|
1648
1643
|
else
|
1649
|
-
is_success =
|
1644
|
+
is_success =false
|
1650
1645
|
log_message("Could not download file: #{f[0]}", Thor::Shell::Color::RED)
|
1651
1646
|
raise Parallel::Kill
|
1652
1647
|
|
1653
1648
|
end
|
1654
1649
|
end
|
1655
1650
|
end
|
1651
|
+
successful_changes = response["result"]["tree"]
|
1652
|
+
if !successful_changes.nil? and is_success
|
1653
|
+
Project.verify_cnvrgignore_exist(project_name,remote)
|
1654
|
+
log_message("Done.\nDownloaded #{successful_changes.size}/#{response["result"]["tree"].size} files", Thor::Shell::Color::GREEN)
|
1655
|
+
else
|
1656
|
+
log_message("Couldn't download some files", Thor::Shell::Color::RED)
|
1657
|
+
|
1658
|
+
end
|
1656
1659
|
rescue Interrupt
|
1657
|
-
is_success = false
|
1658
1660
|
log_message("Couldn't download, Rolling Back all changes.", Thor::Shell::Color::RED)
|
1659
1661
|
|
1660
|
-
@files.
|
1661
|
-
|
1662
|
+
@files.revoke_clone(project_home)
|
1663
|
+
return
|
1664
|
+
end
|
1662
1665
|
end
|
1663
1666
|
|
1664
1667
|
|
1665
1668
|
end
|
1666
|
-
successful_changes = response["result"]["tree"]
|
1667
|
-
if !successful_changes.nil? and is_success
|
1668
|
-
Project.verify_cnvrgignore_exist(project_name, remote)
|
1669
|
-
log_message("Done.\nDownloaded #{successful_changes.size}/#{response["result"]["tree"].size} files", Thor::Shell::Color::GREEN)
|
1670
|
-
else
|
1671
|
-
log_message("Couldn't download some files", Thor::Shell::Color::RED)
|
1672
|
-
|
1673
|
-
end
|
1674
1669
|
|
1675
1670
|
else
|
1676
1671
|
|
1677
|
-
log_message("Error: Couldn't
|
1678
|
-
|
1672
|
+
log_message("Error: Couldn't clone: #{project_name}", Thor::Shell::Color::RED)
|
1673
|
+
@files.revoke_clone(project_home)
|
1674
|
+
|
1675
|
+
return
|
1679
1676
|
end
|
1680
1677
|
rescue SignalException
|
1681
1678
|
say "\nAborting"
|
1682
|
-
|
1679
|
+
@files.revoke_clone(project_home)
|
1680
|
+
|
1681
|
+
return
|
1683
1682
|
end
|
1684
1683
|
|
1685
1684
|
end
|
@@ -2153,6 +2152,7 @@ module Cnvrg
|
|
2153
2152
|
method_option :message, :type => :string, :aliases => ["-m", "--message"], :default => ""
|
2154
2153
|
method_option :deploy, :type => :boolean, :aliases => ["-d", "--deploy"], :default => false
|
2155
2154
|
method_option :return_id, :type => :boolean, :aliases => ["-r", "--return_id"], :default => false
|
2155
|
+
method_option :files, :type => :string, :aliases => ["-f", "--files"], :default => nil
|
2156
2156
|
|
2157
2157
|
def upload(link = false, sync = false, direct = false, ignore_list = "", in_exp = false)
|
2158
2158
|
|
@@ -2169,6 +2169,10 @@ module Cnvrg
|
|
2169
2169
|
@files = Cnvrg::Files.new(@project.owner, @project.slug)
|
2170
2170
|
ignore = options[:ignore] || ""
|
2171
2171
|
force = options[:force] || false
|
2172
|
+
spec_files_to_upload = options["files"]
|
2173
|
+
if !spec_files_to_upload.blank?
|
2174
|
+
spec_files_to_upload = spec_files_to_upload.split(",")
|
2175
|
+
end
|
2172
2176
|
|
2173
2177
|
if ignore.nil? or ignore.empty?
|
2174
2178
|
ignore = ignore_list
|
@@ -2186,7 +2190,7 @@ module Cnvrg
|
|
2186
2190
|
end
|
2187
2191
|
new_branch = options["new_branch"] || false
|
2188
2192
|
|
2189
|
-
result = @project.compare_idx(new_branch, force: force, deploy: options["deploy"],in_exp:in_exp)
|
2193
|
+
result = @project.compare_idx(new_branch, force: force, deploy: options["deploy"],in_exp:in_exp, specific_files: spec_files_to_upload)
|
2190
2194
|
commit = result["result"]["commit"]
|
2191
2195
|
if !link
|
2192
2196
|
if (result["result"]["new_version_exist"] and !force) or ((commit != @project.last_local_commit and !@project.last_local_commit.nil? and !result["result"]["tree"]["updated_on_server"].empty?) and !force)
|
@@ -2197,19 +2201,6 @@ module Cnvrg
|
|
2197
2201
|
log_message("Comparing local changes with remote version:", Thor::Shell::Color::BLUE, (options["verbose"]))
|
2198
2202
|
end
|
2199
2203
|
result = result["result"]["tree"]
|
2200
|
-
# if result["added"].any? {|x| x.include? ".conflict"} or !result["conflicts"].empty?
|
2201
|
-
# all = result["added"].select {|x| x.include? ".conflict"} +result["conflicts"].flatten
|
2202
|
-
# if all.size == 1
|
2203
|
-
# num = "conflict"
|
2204
|
-
# else
|
2205
|
-
# num = "conflicts"
|
2206
|
-
# end
|
2207
|
-
# say "Project contains #{all.size} #{num}:", Thor::Shell::Color::RED
|
2208
|
-
# say "#{all.join("\n")}"
|
2209
|
-
# say "Please fix #{num}, and retry", Thor::Shell::Color::RED
|
2210
|
-
# exit(1)
|
2211
|
-
#
|
2212
|
-
# end
|
2213
2204
|
check = Helpers.checkmark()
|
2214
2205
|
if result["added"].empty? and result["updated_on_local"].empty? and result["deleted"].empty?
|
2215
2206
|
log_message("#{check} Project is up to date", Thor::Shell::Color::GREEN, (((options["sync"] or sync) and !direct) ? false : true))
|
@@ -2833,7 +2824,6 @@ module Cnvrg
|
|
2833
2824
|
else
|
2834
2825
|
# blob
|
2835
2826
|
log_message("downloading file: #{f}", Thor::Shell::Color::BLUE, options["verbose"])
|
2836
|
-
|
2837
2827
|
if @files.download_file_s3(f, relative_path, project_home)
|
2838
2828
|
f
|
2839
2829
|
else
|
@@ -3001,14 +2991,13 @@ module Cnvrg
|
|
3001
2991
|
def show
|
3002
2992
|
path = options['path']
|
3003
2993
|
commit = options['commit']
|
2994
|
+
verify_logged_in(true)
|
2995
|
+
log_start(__method__, args, options)
|
2996
|
+
project_home = get_project_home
|
2997
|
+
@project = Project.new(project_home)
|
3004
2998
|
|
3005
|
-
verify_logged_in(true)
|
3006
|
-
log_start(__method__, args, options)
|
3007
|
-
project_home = get_project_home
|
3008
|
-
@project = Project.new(project_home)
|
3009
2999
|
|
3010
3000
|
|
3011
|
-
project_dir = is_cnvrg_dir(Dir.pwd)
|
3012
3001
|
@files = Cnvrg::Files.new(@project.owner, @project.slug)
|
3013
3002
|
begin
|
3014
3003
|
|
@@ -3084,6 +3073,7 @@ module Cnvrg
|
|
3084
3073
|
method_option :return_id, :type => :boolean, :aliases => ["-r", "--return_id"], :default => false
|
3085
3074
|
method_option :deploy, :type => :boolean, :aliases => ["-d", "--deploy"], :default => false
|
3086
3075
|
method_option :in_exp, :type => :boolean, :aliases => ["-e", "--in_exp"], :default => false
|
3076
|
+
method_option :files, :type => :string, :aliases => ["-f", "--files"], :default => nil
|
3087
3077
|
|
3088
3078
|
def sync(direct = true)
|
3089
3079
|
verify_logged_in(true) if direct
|
@@ -3094,7 +3084,7 @@ module Cnvrg
|
|
3094
3084
|
invoke :download, [true, "", options["in_exp"] ], :new_branch => options["new_branch"], :verbose => options["verbose"], :sync => true
|
3095
3085
|
end
|
3096
3086
|
invoke :upload, [false, true, direct, "",options["in_exp"] ], :new_branch => options["new_branch"], :verbose => options["verbose"], :sync => true,
|
3097
|
-
:ignore => options[:ignore], :force => options[:force], :message => options[:message], :deploy => options["deploy"], :return_id => options["return_id"]
|
3087
|
+
:ignore => options[:ignore], :force => options[:force], :message => options[:message], :deploy => options["deploy"], :return_id => options["return_id"], :files => options["files"]
|
3098
3088
|
|
3099
3089
|
|
3100
3090
|
end
|
@@ -3105,9 +3095,9 @@ module Cnvrg
|
|
3105
3095
|
method_option :small, :type => :boolean, :aliases => ["-sm", "--small"], :default => false
|
3106
3096
|
method_option :medium, :type => :boolean, :aliases => ["-md", "--medium"], :default => false
|
3107
3097
|
method_option :large, :type => :boolean, :aliases => ["-lg", "--large"], :default => false
|
3108
|
-
method_option :
|
3109
|
-
method_option :
|
3110
|
-
method_option :
|
3098
|
+
method_option :gpu_1, :type => :boolean, :aliases => ["--gpu"], :default => false
|
3099
|
+
method_option :gpu_2, :type => :boolean, :aliases => ["--gpuxl"], :default => false
|
3100
|
+
method_option :gpu_3, :type => :boolean, :aliases => ["--gpuxxl"], :default => false
|
3111
3101
|
method_option :sync_before, :type => :boolean, :aliases => ["-sb", "--sync_before"], :default => true
|
3112
3102
|
method_option :sync_after, :type => :boolean, :aliases => ["-sa", "--sync_after"], :default => true
|
3113
3103
|
method_option :title, :type => :string, :aliases => ["-t", "--title"], :default => ""
|
@@ -3153,7 +3143,7 @@ module Cnvrg
|
|
3153
3143
|
options_hash = Hash[options]
|
3154
3144
|
real_options = []
|
3155
3145
|
options_hash.each do |o|
|
3156
|
-
real_options << o if (!o[1].eql? "" and !["small", "medium", "large", "
|
3146
|
+
real_options << o if (!o[1].eql? "" and !["small", "medium", "large", "gpu_1", "gpu_2", "gpu_3"].include? o[0])
|
3157
3147
|
end
|
3158
3148
|
if local
|
3159
3149
|
invoke :exec, [cmd], :sync_before => sync_before, :sync_after => sync_after, :title => title,
|
@@ -3175,7 +3165,7 @@ module Cnvrg
|
|
3175
3165
|
end
|
3176
3166
|
real_options.delete(["local", false])
|
3177
3167
|
instances = {"small" => options["small"], "medium" => options["medium"], "large" => options["large"],
|
3178
|
-
|
3168
|
+
"gpu_1" => options["gpu_2"], "gpu_3" => options["gpuxxl"]}
|
3179
3169
|
instance_type = get_instance_type(instances)
|
3180
3170
|
if !instance_type.nil? and !instance_type.empty?
|
3181
3171
|
real_options << ["machine_type", instance_type]
|
@@ -3212,8 +3202,6 @@ module Cnvrg
|
|
3212
3202
|
method_option :periodic_sync, :type => :string, :aliases => ["-ps", "--periodic_sync"], :default => ""
|
3213
3203
|
def exec(*cmd)
|
3214
3204
|
log = []
|
3215
|
-
cpu_average = 0
|
3216
|
-
memory_average = 0
|
3217
3205
|
verify_logged_in(true)
|
3218
3206
|
log_start(__method__, args, options)
|
3219
3207
|
working_dir = is_cnvrg_dir
|
@@ -3340,6 +3328,24 @@ module Cnvrg
|
|
3340
3328
|
end
|
3341
3329
|
end
|
3342
3330
|
# end
|
3331
|
+
stats_thread = Thread.new do
|
3332
|
+
loop do
|
3333
|
+
begin
|
3334
|
+
stats = remote ? usage_metrics_in_docker(docker_id) : Helpers.linux? ? {memory: memory_usage, cpu: cpu_usage} : {}
|
3335
|
+
if is_on_gpu
|
3336
|
+
gu = gpu_util
|
3337
|
+
stats['gpu'] = gu[0]
|
3338
|
+
stats['gpu_util'] = gu[1]
|
3339
|
+
end
|
3340
|
+
@exp.send_machine_stats [stats]
|
3341
|
+
rescue => e
|
3342
|
+
log_error(e)
|
3343
|
+
log_message("Failed to upload ongoing stats, continuing with experiment", Thor::Shell::Color::YELLOW)
|
3344
|
+
ensure
|
3345
|
+
sleep(30)
|
3346
|
+
end
|
3347
|
+
end
|
3348
|
+
end
|
3343
3349
|
|
3344
3350
|
|
3345
3351
|
log_thread = Thread.new do
|
@@ -3349,30 +3355,7 @@ module Cnvrg
|
|
3349
3355
|
begin
|
3350
3356
|
if log_count != 0
|
3351
3357
|
if time_to_upload <= Time.now - start_loop
|
3352
|
-
|
3353
|
-
stats = usage_metrics_in_docker(docker_id)
|
3354
|
-
cpu = stats[0]
|
3355
|
-
memory = stats[1]
|
3356
|
-
if is_on_gpu
|
3357
|
-
gpu_stats = gpu_util
|
3358
|
-
gpu_utilization = gpu_stats[0]
|
3359
|
-
gpu_memory_util = gpu_stats[1]
|
3360
|
-
end
|
3361
|
-
else
|
3362
|
-
if Helpers.linux?
|
3363
|
-
memory = memory_usage()
|
3364
|
-
cpu = cpu_usage()
|
3365
|
-
end
|
3366
|
-
|
3367
|
-
end
|
3368
|
-
log.each do |l|
|
3369
|
-
if remote and is_on_gpu
|
3370
|
-
l.merge!(cpu: cpu, memory: memory, gpu_util: gpu_utilization, gpu_memory_util: gpu_memory_util)
|
3371
|
-
else
|
3372
|
-
l.merge!(cpu: cpu, memory: memory)
|
3373
|
-
end
|
3374
|
-
end
|
3375
|
-
@exp.upload_temp_log(log, cpu_average, memory_average)
|
3358
|
+
@exp.upload_temp_log(log)
|
3376
3359
|
log = []
|
3377
3360
|
start_loop = Time.now
|
3378
3361
|
end
|
@@ -3416,12 +3399,9 @@ module Cnvrg
|
|
3416
3399
|
|
3417
3400
|
rescue Errno::EIO => e
|
3418
3401
|
log_error(e)
|
3419
|
-
|
3420
|
-
# break
|
3421
3402
|
rescue Errno::ENOENT => e
|
3422
3403
|
|
3423
3404
|
exp_success = false
|
3424
|
-
|
3425
3405
|
log_message("command \"#{cmd}\" couldn't be executed, verify command is valid", Thor::Shell::Color::RED)
|
3426
3406
|
log_error(e)
|
3427
3407
|
rescue Open4::ChildExited
|
@@ -3429,9 +3409,7 @@ module Cnvrg
|
|
3429
3409
|
log_message("The process exited!", Thor::Shell::Color::RED)
|
3430
3410
|
rescue => e
|
3431
3411
|
sleep(20) # end cycle
|
3432
|
-
|
3433
3412
|
res = @exp.end(log, 1, start_commit, cpu_average, memory_average)
|
3434
|
-
|
3435
3413
|
log_message("Error occurred,aborting", Thor::Shell::Color::RED)
|
3436
3414
|
log_error(e)
|
3437
3415
|
exit(0)
|
@@ -3488,11 +3466,12 @@ module Cnvrg
|
|
3488
3466
|
}
|
3489
3467
|
log << cur_log
|
3490
3468
|
sleep(20) # end cycle
|
3491
|
-
|
3492
3469
|
res = @exp.end(log, "-1", end_commit, cpu_average, memory_average)
|
3493
3470
|
|
3494
3471
|
end
|
3495
3472
|
log_error(e)
|
3473
|
+
Thread.kill(log_thread)
|
3474
|
+
Thread.kill(stats_thread)
|
3496
3475
|
|
3497
3476
|
exit(1)
|
3498
3477
|
end
|
@@ -3664,36 +3643,6 @@ module Cnvrg
|
|
3664
3643
|
res = exp.exec_remote(command, commit_to_run, instance_type, image_slug, schedule, local_timestamp, grid, path_to_cmd, data, data_commit,
|
3665
3644
|
periodic_sync, sync_before_terminate, max_time, ds_sync_options)
|
3666
3645
|
if Cnvrg::CLI.is_response_success(res)
|
3667
|
-
# if res["result"]["machine"] == -1
|
3668
|
-
# say "There are no available machines", Thor::Shell::Color::BLUE
|
3669
|
-
# create = yes? "create new machine?", Thor::Shell::Color::YELLOW
|
3670
|
-
# if create
|
3671
|
-
# res = Cnvrg::API.request("users/#{image.owner}/machines/list", 'GET')
|
3672
|
-
# if Cnvrg::CLI.is_response_success(res)
|
3673
|
-
# instance_type = machine_options(res["result"]["aws_options"])
|
3674
|
-
# if @image.new_machine(instance_type)
|
3675
|
-
# say "Running remote experiment", Thor::Shell::Color::BLUE
|
3676
|
-
#
|
3677
|
-
# # res = image.exec_remote(exec_args, exec_options, project.last_local_commit)
|
3678
|
-
# # if Cnvrg::CLI.is_response_success(res)
|
3679
|
-
#
|
3680
|
-
# check = Helpers.checkmark()
|
3681
|
-
# say "#{check} Finished successfuly", Thor::Shell::Color::GREEN
|
3682
|
-
# exit(0)
|
3683
|
-
# # end
|
3684
|
-
# end
|
3685
|
-
# else
|
3686
|
-
# say "No machines are avilable", Thor::Shell::Color::RED
|
3687
|
-
# exit(0)
|
3688
|
-
# end
|
3689
|
-
#
|
3690
|
-
#
|
3691
|
-
# else
|
3692
|
-
# say "Can't execute command on remote machine with local image", Thor::Shell::Color::RED
|
3693
|
-
# exit(1)
|
3694
|
-
#
|
3695
|
-
# end
|
3696
|
-
# else
|
3697
3646
|
check = Helpers.checkmark()
|
3698
3647
|
str = "#{check} Experiment's is on: #{Cnvrg::Helpers.remote_url}/#{project.owner}/projects/#{project.slug}/experiments/#{res["result"]["exp_url"]}"
|
3699
3648
|
|
@@ -3723,18 +3672,17 @@ module Cnvrg
|
|
3723
3672
|
end
|
3724
3673
|
end
|
3725
3674
|
desc 'deploy', 'Deploys model to production'
|
3726
|
-
method_option :small, :type => :boolean, :aliases => ["-
|
3727
|
-
method_option :medium, :type => :boolean, :aliases => ["-
|
3728
|
-
method_option :large, :type => :boolean, :aliases => ["-
|
3675
|
+
method_option :small, :type => :boolean, :aliases => ["-s", "--small"], :default => false
|
3676
|
+
method_option :medium, :type => :boolean, :aliases => ["-m", "--medium"], :default => false
|
3677
|
+
method_option :large, :type => :boolean, :aliases => ["-l", "--large"], :default => false
|
3729
3678
|
method_option :gpu, :type => :boolean, :aliases => ["--gpu"], :default => false
|
3730
3679
|
method_option :gpuxl, :type => :boolean, :aliases => ["--gpuxl"], :default => false
|
3731
3680
|
method_option :gpuxxl, :type => :boolean, :aliases => ["--gpuxxl"], :default => false
|
3732
|
-
method_option :schedule, :type => :string, :aliases => ["--schedule"
|
3733
|
-
|
3681
|
+
method_option :schedule, :type => :string, :aliases => ["--schedule"], :default => ""
|
3734
3682
|
method_option :commit, :type => :string, :aliases => ["--commit", "-c"], :default => ""
|
3735
3683
|
method_option :workers, :type => :string, :aliases => ["--workers", "-w"], :default => ""
|
3736
3684
|
method_option :file_as_input, :type => :boolean, :aliases => ["--input", "-i"], :default => false
|
3737
|
-
|
3685
|
+
method_option :title, :type => :string, :aliases => ["--title", "-t"], :default => ""
|
3738
3686
|
def deploy(file_to_run, function)
|
3739
3687
|
verify_logged_in(true)
|
3740
3688
|
log_start(__method__, args, options)
|
@@ -3744,16 +3692,14 @@ module Cnvrg
|
|
3744
3692
|
"gpu" => options["gpu"], "gpuxl" => options["gpuxl"], "gpuxxl" => options["gpuxxl"]}
|
3745
3693
|
instance_type = get_instance_type(instances)
|
3746
3694
|
|
3747
|
-
|
3748
|
-
|
3695
|
+
schedule = options["schedule"] || ""
|
3696
|
+
title = options['title']
|
3749
3697
|
|
3750
|
-
|
3751
|
-
|
3752
|
-
|
3753
|
-
|
3754
|
-
|
3755
|
-
project = Project.new(working_dir)
|
3756
|
-
commit_to_run = options["commit"] || nil
|
3698
|
+
if !schedule.nil? and !schedule.empty?
|
3699
|
+
local_timestamp = get_schedule_date
|
3700
|
+
end
|
3701
|
+
project = Project.new(working_dir)
|
3702
|
+
commit_to_run = options["commit"] || nil
|
3757
3703
|
|
3758
3704
|
workers = options["workers"] || nil
|
3759
3705
|
begin
|
@@ -3767,14 +3713,8 @@ module Cnvrg
|
|
3767
3713
|
|
3768
3714
|
image = is_project_with_docker(working_dir)
|
3769
3715
|
if !image or !image.is_docker
|
3770
|
-
# say "Couldn't find image related to project", Thor::Shell::Color::RED
|
3771
|
-
# default = yes? "use cnvrg default image?", Thor::Shell::Color::YELLOW
|
3772
|
-
# if default
|
3773
3716
|
image = Images.new(working_dir, "cnvrg")
|
3774
3717
|
image_slug = image.image_slug
|
3775
|
-
# else
|
3776
|
-
# exit(0)
|
3777
|
-
# end
|
3778
3718
|
else
|
3779
3719
|
image_slug = image.image_slug
|
3780
3720
|
end
|
@@ -3782,42 +3722,12 @@ module Cnvrg
|
|
3782
3722
|
|
3783
3723
|
invoke :sync, [false], []
|
3784
3724
|
|
3785
|
-
|
3725
|
+
res = project.deploy(file_to_run, function, nil, commit_to_run, instance_type, image_slug, schedule, local_timestamp, num_workers, file_as_input, title)
|
3786
3726
|
|
3787
3727
|
if Cnvrg::CLI.is_response_success(res)
|
3788
3728
|
|
3789
|
-
|
3790
|
-
|
3791
|
-
# create = yes? "create new machine?", Thor::Shell::Color::YELLOW
|
3792
|
-
# if create
|
3793
|
-
# res = Cnvrg::API.request("users/#{image.owner}/machines/list", 'GET')
|
3794
|
-
# if Cnvrg::CLI.is_response_success(res)
|
3795
|
-
# instance_type = machine_options(res["result"]["aws_options"])
|
3796
|
-
# if @image.new_machine(instance_type)
|
3797
|
-
# say "Running remote experiment", Thor::Shell::Color::BLUE
|
3798
|
-
#
|
3799
|
-
# # res = image.exec_remote(exec_args, exec_options, project.last_local_commit)
|
3800
|
-
# # if Cnvrg::CLI.is_response_success(res)
|
3801
|
-
#
|
3802
|
-
# check = Helpers.checkmark()
|
3803
|
-
# say "#{check} Finished successfuly", Thor::Shell::Color::GREEN
|
3804
|
-
# exit(0)
|
3805
|
-
# # end
|
3806
|
-
# end
|
3807
|
-
# else
|
3808
|
-
# say "No machines are avilable", Thor::Shell::Color::RED
|
3809
|
-
# exit(0)
|
3810
|
-
# end
|
3811
|
-
#
|
3812
|
-
#
|
3813
|
-
# else
|
3814
|
-
# say "Can't execute command on remote machine with local image", Thor::Shell::Color::RED
|
3815
|
-
# exit(1)
|
3816
|
-
#
|
3817
|
-
# end
|
3818
|
-
# else
|
3819
|
-
check = Helpers.checkmark()
|
3820
|
-
log_message("#{check} Deployment process is on: #{Cnvrg::Helpers.remote_url}/#{project.owner}/projects/#{project.slug}/deploys/show/#{res["result"]["deploy_slug"]}", Thor::Shell::Color::GREEN)
|
3729
|
+
check = Helpers.checkmark()
|
3730
|
+
log_message("#{check} Deployment process is on: #{Cnvrg::Helpers.remote_url}/#{project.owner}/projects/#{project.slug}/endpoints/show/#{res["result"]["deploy_slug"]}", Thor::Shell::Color::GREEN)
|
3821
3731
|
|
3822
3732
|
exit(0)
|
3823
3733
|
# end
|
@@ -6057,31 +5967,6 @@ module Cnvrg
|
|
6057
5967
|
history = container.exec(command, tty: true)[0]
|
6058
5968
|
diff = [pip, dpkg, history]
|
6059
5969
|
return diff
|
6060
|
-
# File.open(dir+"/.cnvrg/pip_#{date}.txt", "w+") { |f| f.write pip }
|
6061
|
-
# File.open(dir+"/.cnvrg/dpkg_#{date}.txt", "w+") { |f| f.write dpkg }
|
6062
|
-
# File.open(dir+"/.cnvrg/history_#{date}.txt", "w+") { |f| f.write history }
|
6063
|
-
#
|
6064
|
-
# pip_new = pip[0].split("\r\n")
|
6065
|
-
# pip_base_file =JSON.parse(File.open( dir+"/.cnvrg/pip_base.txt","rb").read)
|
6066
|
-
# pip_base = pip_base_file[0].split("\r\n")
|
6067
|
-
#
|
6068
|
-
# pip_diff = pip_new - pip_base
|
6069
|
-
# if pip_diff.empty?
|
6070
|
-
# puts "pip is same"
|
6071
|
-
# else
|
6072
|
-
# puts pip_diff
|
6073
|
-
# end
|
6074
|
-
# dpkg_new = dpkg[0].split("\r\n")
|
6075
|
-
# dpkg_base_file =JSON.parse(File.open( dir+"/.cnvrg/dpkg_base.txt","rb").read)
|
6076
|
-
# dpkg_base = dpkg_base_file[0].split("\r\n")
|
6077
|
-
#
|
6078
|
-
# dpkg_diff = dpkg_new - dpkg_base
|
6079
|
-
# if dpkg_diff.empty?
|
6080
|
-
# puts "dpkg is same"
|
6081
|
-
# else
|
6082
|
-
# puts dpkg_diff
|
6083
|
-
# end
|
6084
|
-
# puts history
|
6085
5970
|
end
|
6086
5971
|
|
6087
5972
|
def is_port_taken(ip = Cnvrg::CLI::IP, port = Cnvrg::CLI::PORT, seconds = 1)
|
@@ -6098,7 +5983,7 @@ module Cnvrg
|
|
6098
5983
|
end
|
6099
5984
|
|
6100
5985
|
def image_activity(image)
|
6101
|
-
res = image.handle_image_activity
|
5986
|
+
res = image.handle_image_activity
|
6102
5987
|
if res == -1
|
6103
5988
|
#image is not known
|
6104
5989
|
say "Images #{image.image_name} is not known", Thor::Shell::Color::YELLOW
|
@@ -6132,6 +6017,29 @@ module Cnvrg
|
|
6132
6017
|
|
6133
6018
|
end
|
6134
6019
|
|
6020
|
+
|
6021
|
+
|
6022
|
+
def format_schedule(schedule)
|
6023
|
+
if schedule.start_with? 'in'
|
6024
|
+
time = schedule.split(" ")
|
6025
|
+
|
6026
|
+
local = Time.now.localtime
|
6027
|
+
if time[2].downcase().start_with? "min"
|
6028
|
+
new = local + (time[1].to_i * 60)
|
6029
|
+
elsif time[2].downcase().start_with? "hours"
|
6030
|
+
new = local + (time[1].to_i * 3600)
|
6031
|
+
elsif time[2].downcase().start_with? "days"
|
6032
|
+
new = local + (time[1].to_i * 3600 * 24)
|
6033
|
+
else
|
6034
|
+
log_message("Could not undersatnd when to schedule experiment", Thor::Shell::Color::RED)
|
6035
|
+
exit(1)
|
6036
|
+
end
|
6037
|
+
new_time = new.to_s
|
6038
|
+
new_time = new_time[0, new_time.size-6] #remove timezone
|
6039
|
+
schedule = "at #{new_time}"
|
6040
|
+
end
|
6041
|
+
schedule
|
6042
|
+
end
|
6135
6043
|
def update_deleted(deleted)
|
6136
6044
|
final = []
|
6137
6045
|
deleted.each do |d|
|
@@ -6139,7 +6047,7 @@ module Cnvrg
|
|
6139
6047
|
to_add = true
|
6140
6048
|
value = all_subs[0]
|
6141
6049
|
all_subs.each_with_index do |a, i|
|
6142
|
-
if final.include? value
|
6050
|
+
if final.include? value+"/"
|
6143
6051
|
to_add = false
|
6144
6052
|
break
|
6145
6053
|
end
|
@@ -6147,7 +6055,6 @@ module Cnvrg
|
|
6147
6055
|
end
|
6148
6056
|
final << d if to_add
|
6149
6057
|
|
6150
|
-
|
6151
6058
|
end
|
6152
6059
|
|
6153
6060
|
|
@@ -6258,7 +6165,7 @@ module Cnvrg
|
|
6258
6165
|
end
|
6259
6166
|
|
6260
6167
|
def usage_metrics_in_docker(docker_id)
|
6261
|
-
res =
|
6168
|
+
res = {cpu: 0.0, memory: 0.0}
|
6262
6169
|
begin
|
6263
6170
|
if docker_id.nil?
|
6264
6171
|
docker_id = `cat /etc/hostname`
|
@@ -6268,7 +6175,7 @@ module Cnvrg
|
|
6268
6175
|
conv = stats.split(",")
|
6269
6176
|
cpu = conv[0].gsub!("%", "").to_f
|
6270
6177
|
memory = conv[1].gsub!("%", "").to_f
|
6271
|
-
res =
|
6178
|
+
res = {cpu: cpu, memory: memory}
|
6272
6179
|
return res
|
6273
6180
|
end
|
6274
6181
|
rescue
|
data/lib/cnvrg/experiment.rb
CHANGED
@@ -103,12 +103,17 @@ module Cnvrg
|
|
103
103
|
return response
|
104
104
|
end
|
105
105
|
|
106
|
-
def upload_temp_log(temp_log
|
106
|
+
def upload_temp_log(temp_log)
|
107
107
|
response = Cnvrg::API.request(@base_resource + "experiment/upload_temp_log", 'POST', {output: temp_log,
|
108
108
|
exp_slug: @slug})
|
109
109
|
Cnvrg::CLI.is_response_success(response,false)
|
110
110
|
end
|
111
111
|
|
112
|
+
def send_machine_stats(stats)
|
113
|
+
response = Cnvrg::API.request(@base_resource + "experiment/upload_stats", "POST", {exp_slug: @slug, stats: stats.map{|s| s.merge!({time: Time.now})}})
|
114
|
+
Cnvrg::CLI.is_response_success(response,false)
|
115
|
+
end
|
116
|
+
|
112
117
|
def end(output, exit_status, end_commit, cpu_average, memory_average)
|
113
118
|
#if remote try to remove
|
114
119
|
response = Cnvrg::API.request(@base_resource + "experiment/end", 'POST', {output: output, exp_slug: @slug,
|
data/lib/cnvrg/files.rb
CHANGED
@@ -3,6 +3,7 @@ require 'aws-sdk'
|
|
3
3
|
require 'URLcrypt'
|
4
4
|
require 'tempfile'
|
5
5
|
require 'net/http'
|
6
|
+
require 'cnvrg/result'
|
6
7
|
module Cnvrg
|
7
8
|
class Files
|
8
9
|
|
@@ -373,6 +374,7 @@ module Cnvrg
|
|
373
374
|
return Cnvrg::CLI.is_response_success(response, false)
|
374
375
|
end
|
375
376
|
|
377
|
+
|
376
378
|
def download_file_s3(absolute_path, relative_path, project_home, commit_sha1=nil, conflict=false)
|
377
379
|
begin
|
378
380
|
res = Cnvrg::API.request(@base_resource + "download_file", 'POST', {absolute_path: absolute_path, relative_path: relative_path,
|
@@ -402,6 +404,7 @@ module Cnvrg
|
|
402
404
|
end
|
403
405
|
end
|
404
406
|
if !success
|
407
|
+
puts "error in sts"
|
405
408
|
return false
|
406
409
|
end
|
407
410
|
|
@@ -445,11 +448,127 @@ module Cnvrg
|
|
445
448
|
end
|
446
449
|
|
447
450
|
rescue => e
|
448
|
-
|
451
|
+
puts "error in aws"
|
452
|
+
|
453
|
+
puts e.message
|
449
454
|
return false
|
450
455
|
|
451
456
|
end
|
452
457
|
end
|
458
|
+
def download_multiple_files_s3(files, project_home)
|
459
|
+
begin
|
460
|
+
|
461
|
+
sts_path = files["path_sts"]
|
462
|
+
retries = 0
|
463
|
+
success= false
|
464
|
+
while !success and retries < 20
|
465
|
+
begin
|
466
|
+
if !Helpers.is_verify_ssl
|
467
|
+
body = open(sts_path, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}).read
|
468
|
+
else
|
469
|
+
body = open(sts_path).read
|
470
|
+
end
|
471
|
+
success = true
|
472
|
+
rescue => e
|
473
|
+
retries +=1
|
474
|
+
sleep(5)
|
475
|
+
|
476
|
+
end
|
477
|
+
end
|
478
|
+
if !success
|
479
|
+
return Cnvrg::Result.new(false,"couldn't download some files", "error in sts", "" )
|
480
|
+
end
|
481
|
+
split = body.split("\n")
|
482
|
+
key = split[0]
|
483
|
+
iv = split[1]
|
484
|
+
|
485
|
+
access = Cnvrg::Helpers.decrypt(key, iv, files["sts_a"])
|
486
|
+
|
487
|
+
secret = Cnvrg::Helpers.decrypt(key,iv, files["sts_s"])
|
488
|
+
|
489
|
+
session = Cnvrg::Helpers.decrypt(key,iv, files["sts_st"])
|
490
|
+
region = Cnvrg::Helpers.decrypt(key,iv, files["region"])
|
491
|
+
|
492
|
+
bucket = Cnvrg::Helpers.decrypt(key,iv, files["bucket"])
|
493
|
+
is_s3 = files["is_s3"]
|
494
|
+
if is_s3 or is_s3.nil?
|
495
|
+
client = Aws::S3::Client.new(
|
496
|
+
:access_key_id =>access,
|
497
|
+
:secret_access_key => secret,
|
498
|
+
:session_token => session,
|
499
|
+
:region => region,
|
500
|
+
:http_open_timeout => 60, :retry_limit => 20)
|
501
|
+
else
|
502
|
+
endpoint = Cnvrg::Helpers.decrypt(key,iv, files["endpoint_url"])
|
503
|
+
client = Aws::S3::Client.new(
|
504
|
+
:access_key_id =>access,
|
505
|
+
:secret_access_key => secret,
|
506
|
+
:region => region,
|
507
|
+
:endpoint=> endpoint,:force_path_style=> true,:ssl_verify_peer=>false,
|
508
|
+
:http_open_timeout => 60, :retry_limit => 20)
|
509
|
+
end
|
510
|
+
download_succ_count = 0
|
511
|
+
parallel_options = {
|
512
|
+
:progress => {
|
513
|
+
:title => "Download Progress",
|
514
|
+
:progress_mark => '=',
|
515
|
+
:format => "%b>>%i| %p%% %t",
|
516
|
+
:starting_at => 0,
|
517
|
+
:total => files["keys"].size,
|
518
|
+
:autofinish => true
|
519
|
+
},
|
520
|
+
in_threads: Cnvrg::Helpers.parallel_threads,
|
521
|
+
isolation: true
|
522
|
+
}
|
523
|
+
Parallel.map(files["keys"], parallel_options) do |f|
|
524
|
+
|
525
|
+
file_path = f["name"]
|
526
|
+
if file_path.end_with? "/"
|
527
|
+
# dir
|
528
|
+
if download_dir(file_path, file_path, project_home)
|
529
|
+
download_succ_count += 1
|
530
|
+
else
|
531
|
+
return Cnvrg::Result.new(false,"Could not create directory: #{file_path}")
|
532
|
+
raise Parallel::Kill
|
533
|
+
end
|
534
|
+
else
|
535
|
+
# blob
|
536
|
+
begin
|
537
|
+
file_key = Cnvrg::Helpers.decrypt(key,iv, f["path"])
|
538
|
+
resp = false
|
539
|
+
File.open(project_home+"/"+file_path, 'w+') do |file|
|
540
|
+
resp = client.get_object({bucket:bucket,
|
541
|
+
key:file_key}, target: file)
|
542
|
+
end
|
543
|
+
if resp
|
544
|
+
download_succ_count +=1
|
545
|
+
else
|
546
|
+
return Cnvrg::Result(false,"Could not create file: #{file_path}")
|
547
|
+
end
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
rescue => e
|
552
|
+
return Cnvrg::Result.new(false,"Could not create file: #{file_path}", e.message, e.backtrace)
|
553
|
+
raise Parallel::Kill
|
554
|
+
end
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
end
|
559
|
+
end
|
560
|
+
if download_succ_count == files["keys"].size
|
561
|
+
return Cnvrg::Result.new(true,"Done.\nDownloaded #{download_succ_count} files")
|
562
|
+
end
|
563
|
+
rescue => e
|
564
|
+
|
565
|
+
return Cnvrg::Result.new(false,"Could not download some files", e.message, e.backtrace)
|
566
|
+
end
|
567
|
+
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
end
|
453
572
|
|
454
573
|
def download_file(absolute_path, relative_path, project_home, conflict=false)
|
455
574
|
res = Cnvrg::API.request(@base_resource + "download_file", 'POST', {absolute_path: absolute_path, relative_path: relative_path})
|
@@ -560,6 +679,13 @@ module Cnvrg
|
|
560
679
|
return true
|
561
680
|
|
562
681
|
end
|
682
|
+
def revoke_clone(project_home)
|
683
|
+
begin
|
684
|
+
FileUtils.rm_rf(project_home)
|
685
|
+
rescue
|
686
|
+
end
|
687
|
+
|
688
|
+
end
|
563
689
|
def delete_commit_files_local(deleted)
|
564
690
|
begin
|
565
691
|
FileUtils.rm_rf(deleted) unless (deleted.nil? or deleted.empty?)
|
data/lib/cnvrg/helpers.rb
CHANGED
data/lib/cnvrg/project.rb
CHANGED
@@ -356,16 +356,18 @@ module Cnvrg
|
|
356
356
|
return response
|
357
357
|
end
|
358
358
|
|
359
|
-
def compare_idx(new_branch, commit:last_local_commit,force:false, deploy: false, in_exp:false)
|
359
|
+
def compare_idx(new_branch, commit:last_local_commit,force:false, deploy: false, in_exp:false, specific_files: [])
|
360
360
|
if commit.nil?
|
361
361
|
local_idx = YAML.load_file("#{self.local_path}/.cnvrg/idx.yml")
|
362
362
|
else
|
363
363
|
local_idx = self.generate_idx(deploy: deploy)
|
364
364
|
end
|
365
365
|
ignore_list = self.send_ignore_list()
|
366
|
-
if force
|
366
|
+
if force or !specific_files.blank?
|
367
367
|
added = []
|
368
|
-
if
|
368
|
+
if !specific_files.blank?
|
369
|
+
added = specific_files
|
370
|
+
elsif local_idx[:tree]
|
369
371
|
added << local_idx[:tree].keys
|
370
372
|
added.flatten!
|
371
373
|
end
|
@@ -413,14 +415,15 @@ module Cnvrg
|
|
413
415
|
return true
|
414
416
|
end
|
415
417
|
|
416
|
-
def deploy(file_to_run, function, input_params, commit_to_run, instance_type, image_slug, scheduling_query, local_timestamp,workers, file_input)
|
418
|
+
def deploy(file_to_run, function, input_params, commit_to_run, instance_type, image_slug, scheduling_query, local_timestamp,workers, file_input, title)
|
417
419
|
response = Cnvrg::API.request("users/#{@owner}/projects/#{@slug}/deploy", 'POST', {file_to_run: file_to_run, function: function,
|
418
420
|
image_slug: image_slug, input_params: input_params,
|
419
421
|
commit_sha1: commit_to_run,
|
420
422
|
instance_type: instance_type,
|
421
423
|
scheduling_query: scheduling_query,
|
422
424
|
local_timestamp: local_timestamp,
|
423
|
-
workers:workers,file_input:file_input
|
425
|
+
workers:workers,file_input:file_input,
|
426
|
+
title: title})
|
424
427
|
return response
|
425
428
|
end
|
426
429
|
def list_commits
|
data/lib/cnvrg/result.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
module Cnvrg
|
3
|
+
class Result
|
4
|
+
attr_reader :msg, :msg_color, :e_msg, :e_msg_backtrace
|
5
|
+
|
6
|
+
def initialize(success, msg, e_msg = "", e_backtrace = "")
|
7
|
+
begin
|
8
|
+
@success = success
|
9
|
+
@msg = msg
|
10
|
+
@e_msg = e_msg
|
11
|
+
@e_msg_backtrace = e_backtrace
|
12
|
+
if !@success
|
13
|
+
@msg_color = Thor::Shell::Color::RED
|
14
|
+
else
|
15
|
+
@msg_color = Thor::Shell::Color::GREEN
|
16
|
+
|
17
|
+
end
|
18
|
+
rescue => e
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
def is_success?
|
23
|
+
return @success
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
end
|
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: 0.4.
|
4
|
+
version: 0.4.1.4
|
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: 2018-05-
|
12
|
+
date: 2018-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -422,6 +422,7 @@ files:
|
|
422
422
|
- lib/cnvrg/helpers.rb
|
423
423
|
- lib/cnvrg/job.rb
|
424
424
|
- lib/cnvrg/project.rb
|
425
|
+
- lib/cnvrg/result.rb
|
425
426
|
- lib/cnvrg/runner.rb
|
426
427
|
- lib/cnvrg/ssh.rb
|
427
428
|
- lib/cnvrg/version.rb
|