cnvrg 1.6.0.7 → 1.6.0.8
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 +16 -33
- data/lib/cnvrg/data.rb +17 -4
- data/lib/cnvrg/dataset.rb +6 -3
- data/lib/cnvrg/experiment.rb +4 -4
- data/lib/cnvrg/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 319b1e08fd56c2a26834b3a2e2fc94565e2abad1d0244c72e4e45c11a8cc7d3d
|
4
|
+
data.tar.gz: 60edde88d619c8aae0afded8314c2688545712445718e99576a7ec20222d795e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dc2c22f8c1f4c696c0580f2ab2c3122d57061a95591bff13403a2e93412f6268b50a23119ba5ccbaa0830bd8f87474490be50ccf6d128c378b39d4a1cffaca3
|
7
|
+
data.tar.gz: 4628fee3352fb89fb639ed3aef3e76ce2cadff9c916d153a940416d25ac81f8e700b2891cca6682c95e9526342c089ef631f2c16d9df9ca84cc4faccaac70e28
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -2888,7 +2888,8 @@ module Cnvrg
|
|
2888
2888
|
method_option :email_notification, :type => :boolean, :aliases => ["-en", "--email_notification"], :default => false
|
2889
2889
|
method_option :upload_output, :type => :string, :aliases => ["-uo", "--upload_output"], :default => ""
|
2890
2890
|
method_option :commit, :type => :string, :aliases => ["-c", "--commit"], :default => ""
|
2891
|
-
method_option :schedule, :type => :string, :aliases => ["
|
2891
|
+
method_option :schedule, :type => :string, :aliases => ["--schedule"], :default => ""
|
2892
|
+
method_option :recurring, :type => :string, :aliases => ["--recurring"], :default => ""
|
2892
2893
|
method_option :image, :type => :string, :aliases => ["--image"], :default => nil
|
2893
2894
|
method_option :grid, :type => :string, :aliases => ["-g", "--grid"], :default => ""
|
2894
2895
|
method_option :data, :type => :string, :aliases => ["-d", "--data"], :default => ""
|
@@ -2922,6 +2923,7 @@ module Cnvrg
|
|
2922
2923
|
upload_output = options["upload_output"]
|
2923
2924
|
local = options["local"]
|
2924
2925
|
schedule = options["schedule"]
|
2926
|
+
recurring = options["recurring"]
|
2925
2927
|
image = options["image"] || nil
|
2926
2928
|
grid = options["grid"]
|
2927
2929
|
data = options["data"]
|
@@ -2982,7 +2984,7 @@ module Cnvrg
|
|
2982
2984
|
options["machine"] => !options["machine"].blank? }
|
2983
2985
|
instance_type = get_instance_type(instances)
|
2984
2986
|
invoke :exec_remote, [cmd], :sync_before => sync_before, :sync_after => sync_after, :title => title, :machine_type => instance_type,
|
2985
|
-
:schedule => schedule, :log => log, :email_notification => email_notification, :upload_output => upload_output, :commit => commit,
|
2987
|
+
:schedule => schedule, :recurring => recurring, :log => log, :email_notification => email_notification, :upload_output => upload_output, :commit => commit,
|
2986
2988
|
:image => image, :grid => grid, :data => data, :data_commit => data_commit, :ignore => ignore, :force => force, :sync_before_terminate => sync_before_terminate,
|
2987
2989
|
:max_time => max_time,
|
2988
2990
|
:periodic_sync => periodic_sync, :dataset_only_tree=> dataset_only_tree,
|
@@ -3271,7 +3273,8 @@ module Cnvrg
|
|
3271
3273
|
method_option :email_notification, :type => :boolean, :aliases => ["-en", "--email_notification"], :default => false
|
3272
3274
|
method_option :upload_output, :type => :string, :aliases => ["-uo", "--upload_output"], :default => ""
|
3273
3275
|
method_option :machine_type, :type => :string, :default => ""
|
3274
|
-
method_option :schedule, :type => :string, :aliases => ["
|
3276
|
+
method_option :schedule, :type => :string, :aliases => ["--schedule"], :default => ""
|
3277
|
+
method_option :recurring, :type => :string, :aliases => ["--recurring"], :default => ""
|
3275
3278
|
method_option :commit, :type => :string, :aliases => ["-c, --commit"], :default => nil
|
3276
3279
|
method_option :image, :type => :string, :aliases => ["-i", "--image"], :default => ""
|
3277
3280
|
method_option :grid, :type => :string, :aliases => ["-g", "--grid"], :default => ""
|
@@ -3329,24 +3332,7 @@ module Cnvrg
|
|
3329
3332
|
restart_if_stuck = options["restart_if_stuck"]
|
3330
3333
|
instance_type = options["machine_type"] || nil
|
3331
3334
|
schedule = options["schedule"] || ""
|
3332
|
-
|
3333
|
-
time = schedule.split(" ")
|
3334
|
-
|
3335
|
-
local = Time.now.localtime
|
3336
|
-
if time[2].downcase().start_with? "min"
|
3337
|
-
new = local + (time[1].to_i * 60)
|
3338
|
-
elsif time[2].downcase().start_with? "hours"
|
3339
|
-
new = local + (time[1].to_i * 3600)
|
3340
|
-
elsif time[2].downcase().start_with? "days"
|
3341
|
-
new = local + (time[1].to_i * 3600 * 24)
|
3342
|
-
else
|
3343
|
-
log_message("Could not undersatnd when to schedule experiment", Thor::Shell::Color::RED)
|
3344
|
-
exit(1)
|
3345
|
-
end
|
3346
|
-
new_time = new.to_s
|
3347
|
-
new_time = new_time[0, new_time.size - 6] #remove timezone
|
3348
|
-
schedule = "at #{new_time}"
|
3349
|
-
end
|
3335
|
+
recurring = options["recurring"] || ""
|
3350
3336
|
upload_output = options["upload_output"]
|
3351
3337
|
time_to_upload = calc_output_time(upload_output)
|
3352
3338
|
if time_to_upload == 0 or time_to_upload == -1
|
@@ -3364,7 +3350,7 @@ module Cnvrg
|
|
3364
3350
|
git_branch = options["git_branch"]
|
3365
3351
|
options_hash = Hash[options]
|
3366
3352
|
local_folders_options = options["local_folders"]
|
3367
|
-
options_hash.except!("schedule", "machine_type", "image", "upload_output", "grid", "data", "data_commit", "title",
|
3353
|
+
options_hash.except!("schedule", "recurring", "machine_type", "image", "upload_output", "grid", "data", "data_commit", "title",
|
3368
3354
|
"local", "small", "medium", "large", "gpu", "gpuxl", "gpuxxl","max_time","dataset_only_tree",
|
3369
3355
|
"data_query", "git_commit","git_branch", "restart_if_stuck","local_folders","output_dir", "commit", "datasets", "requirements", "prerun" )
|
3370
3356
|
exec_options = options_hash.map {|x| "--#{x[0]}=#{x[1]}"}.flatten.join(" ")
|
@@ -3437,7 +3423,7 @@ module Cnvrg
|
|
3437
3423
|
|
3438
3424
|
res = exp.exec_remote(command, commit_to_run, instance_type, image, schedule, local_timestamp, grid, path_to_cmd, data, data_commit,
|
3439
3425
|
periodic_sync, sync_before_terminate, max_time, ds_sync_options,output_dir,
|
3440
|
-
data_query, git_commit, git_branch, restart_if_stuck,local_folders_options, title, datasets, prerun: prerun, requirements: requirements)
|
3426
|
+
data_query, git_commit, git_branch, restart_if_stuck,local_folders_options, title, datasets, prerun: prerun, requirements: requirements, recurring: recurring)
|
3441
3427
|
if Cnvrg::CLI.is_response_success(res)
|
3442
3428
|
check = Helpers.checkmark()
|
3443
3429
|
str = "#{check} Experiment's is on: #{Cnvrg::Helpers.remote_url}/#{project.owner}/projects/#{project.slug}/experiments/#{res["result"]["exp_url"]}"
|
@@ -5355,7 +5341,7 @@ module Cnvrg
|
|
5355
5341
|
@image.update_image_activity(project.last_local_commit, nil)
|
5356
5342
|
end
|
5357
5343
|
|
5358
|
-
desc 'check_pod_restart',
|
5344
|
+
desc 'check_pod_restart', 'Check pod restart', :hide => true
|
5359
5345
|
def check_pod_restart
|
5360
5346
|
Cnvrg::CLI.new.log_start(__method__, args, options)
|
5361
5347
|
@project = Project.new(owner: ENV['CNVRG_OWNER'], slug: ENV['CNVRG_PROJECT'])
|
@@ -5486,6 +5472,10 @@ module Cnvrg
|
|
5486
5472
|
end
|
5487
5473
|
|
5488
5474
|
def self.log_message(message, type = Thor::Shell::Color::BLUE, to_print: true)
|
5475
|
+
if $LOG.blank?
|
5476
|
+
### handle case when $LOG is not initialized
|
5477
|
+
CLI.new.log_handler
|
5478
|
+
end
|
5489
5479
|
case type
|
5490
5480
|
when Thor::Shell::Color::BLUE, 'blue', 'progress'
|
5491
5481
|
color = Thor::Shell::Color::BLUE
|
@@ -5503,18 +5493,11 @@ module Cnvrg
|
|
5503
5493
|
color = nil
|
5504
5494
|
$LOG.info message: message, type: "unknown"
|
5505
5495
|
end
|
5506
|
-
say "#{color}#{message}" if to_print
|
5496
|
+
say "#{color}#{message}#{Thor::Shell::Color::CLEAR}" if to_print
|
5507
5497
|
end
|
5508
5498
|
|
5509
5499
|
def log_message(message, type=Thor::Shell::Color::GREEN, to_print = true)
|
5510
|
-
|
5511
|
-
say message, type
|
5512
|
-
end
|
5513
|
-
begin
|
5514
|
-
Cnvrg::Logger.log_info(message)
|
5515
|
-
rescue => e
|
5516
|
-
Cnvrg::Logger.log_error(e)
|
5517
|
-
end
|
5500
|
+
CLI.log_message(message, type, to_print: to_print)
|
5518
5501
|
end
|
5519
5502
|
|
5520
5503
|
def log_error(e)
|
data/lib/cnvrg/data.rb
CHANGED
@@ -29,13 +29,27 @@ module Cnvrg
|
|
29
29
|
cli.init_data(public, bucket: bucket)
|
30
30
|
end
|
31
31
|
|
32
|
-
desc "data link", "Set current directory as dataset directory"
|
33
|
-
def link(
|
32
|
+
desc "data link DATASET_SLUG", "Set current directory as dataset directory"
|
33
|
+
def link(dataset=nil)
|
34
34
|
begin
|
35
|
-
raise Exception.new("Please enter dataset name") if dataset_slug.blank?
|
36
35
|
cli = Cnvrg::CLI.new()
|
37
36
|
cli.verify_logged_in(false)
|
38
37
|
cli.log_start(__method__, args, options)
|
38
|
+
|
39
|
+
if dataset.include? "/"
|
40
|
+
## this case is to support DATASET_URL expected example: domain.com/organization_name/datasets/dataset_name
|
41
|
+
url_parts = dataset.split("/")
|
42
|
+
dataset_index = Cnvrg::Helpers.look_for_in_path(dataset, "datasets")
|
43
|
+
dataset_slug = url_parts[dataset_index + 1]
|
44
|
+
owner = url_parts[dataset_index - 1]
|
45
|
+
raise Exception.new("Can't find all dataset information please check the URL") if dataset_slug.blank? or owner.blank?
|
46
|
+
else
|
47
|
+
## this case is to support DATASET_SLUG expected example: dataset_name
|
48
|
+
# in this case it will take the organization from the config file
|
49
|
+
dataset_slug = dataset
|
50
|
+
raise Exception.new("Please enter dataset name or dataset full url") if dataset_slug.blank?
|
51
|
+
owner = CLI.get_owner
|
52
|
+
end
|
39
53
|
|
40
54
|
config_validation = Dataset.validate_config
|
41
55
|
if config_validation[:validation] == Data::ConfigValidation::SUCCESS
|
@@ -47,7 +61,6 @@ module Cnvrg
|
|
47
61
|
end
|
48
62
|
|
49
63
|
cli.log_message("Linking dataset: #{dataset_slug} to the current directory", Thor::Shell::Color::BLUE)
|
50
|
-
owner = CLI.get_owner
|
51
64
|
success = Dataset.link_dataset(owner: owner, slug: dataset_slug)
|
52
65
|
if success
|
53
66
|
cli.log_message("Dataset: #{dataset_slug} linked successfully to the current directory")
|
data/lib/cnvrg/dataset.rb
CHANGED
@@ -320,6 +320,12 @@ module Cnvrg
|
|
320
320
|
return unless success
|
321
321
|
result = response["result"]
|
322
322
|
|
323
|
+
sha1 = result["init_commit_sha1"]
|
324
|
+
|
325
|
+
# We need to write init IDX that contain init commit sha1 so the user will be able to doing actions on the dataset
|
326
|
+
# so it only relevant for new server
|
327
|
+
raise Exception.new("This feature is not available for your cnvrg version. Please contact support for more information") if sha1.blank? ## means this is old version of server
|
328
|
+
|
323
329
|
config = {dataset_name: result["title"],
|
324
330
|
dataset_slug: result["slug"],
|
325
331
|
owner: owner}
|
@@ -332,10 +338,7 @@ module Cnvrg
|
|
332
338
|
FileUtils.touch list_files
|
333
339
|
File.open(".cnvrg/config.yml", "w+") {|f| f.write config.to_yaml}
|
334
340
|
|
335
|
-
# Write init IDX that contain init commit sha1 so the user will be able to doing actions on the dataset
|
336
|
-
# Relevant only for new server
|
337
341
|
dataset = Dataset.new(Dir.pwd)
|
338
|
-
sha1 = result["init_commit_sha1"]
|
339
342
|
dataset.write_idx({}, sha1)
|
340
343
|
true
|
341
344
|
rescue => e
|
data/lib/cnvrg/experiment.rb
CHANGED
@@ -88,13 +88,13 @@ module Cnvrg
|
|
88
88
|
|
89
89
|
end
|
90
90
|
|
91
|
-
def exec_remote(command, commit_to_run, instance_type, image_slug,
|
91
|
+
def exec_remote(command, commit_to_run, instance_type, image_slug,schedule,local_timestamp, grid,path_to_cmd,data, data_commit,periodic_sync,
|
92
92
|
sync_before_terminate, max_time, ds_sync_options=0,output_dir=nil,data_query=nil,
|
93
|
-
git_commit=nil, git_branch=nil, restart_if_stuck=nil, local_folders=nil,title=nil, datasets=nil, prerun: true, requirements: true)
|
93
|
+
git_commit=nil, git_branch=nil, restart_if_stuck=nil, local_folders=nil,title=nil, datasets=nil, prerun: true, requirements: true, recurring: nil)
|
94
94
|
response = Cnvrg::API.request("users/#{@owner}/projects/#{@project_slug}/experiment/remote", 'POST', {command: command, image_slug: image_slug,
|
95
95
|
commit_sha1: commit_to_run,
|
96
96
|
instance_type: instance_type,
|
97
|
-
|
97
|
+
schedule:schedule,
|
98
98
|
local_timestamp:local_timestamp,
|
99
99
|
datasets: datasets,
|
100
100
|
grid: grid,
|
@@ -104,7 +104,7 @@ module Cnvrg
|
|
104
104
|
dataset_sync_options:ds_sync_options,output_dir:output_dir,
|
105
105
|
dataset_query:data_query,git_commit:git_commit,git_branch:git_branch,
|
106
106
|
restart_if_stuck:restart_if_stuck, local_folders: local_folders, title:title,
|
107
|
-
prerun: prerun, requirements: requirements})
|
107
|
+
prerun: prerun, requirements: requirements, recurring: recurring})
|
108
108
|
|
109
109
|
return response
|
110
110
|
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: 1.6.0.
|
4
|
+
version: 1.6.0.8
|
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-12-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -476,7 +476,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
476
476
|
- !ruby/object:Gem::Version
|
477
477
|
version: '0'
|
478
478
|
requirements: []
|
479
|
-
rubygems_version: 3.0.
|
479
|
+
rubygems_version: 3.0.4
|
480
480
|
signing_key:
|
481
481
|
specification_version: 4
|
482
482
|
summary: A CLI tool for interacting with cnvrg.io.
|