cnvrg 0.8.0 → 0.8.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/api.rb +3 -3
- data/lib/cnvrg/cli.rb +10 -13
- data/lib/cnvrg/files.rb +1 -3
- data/lib/cnvrg/project.rb +21 -0
- data/lib/cnvrg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0513fe7eb80b8633e3012478fe86baad4f11585f
|
4
|
+
data.tar.gz: 7a31042c326555ffc8d59c14abc2c09c0635a138
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c811b17a9f6f77ef8c99363adbd0868686349f93bcae165845b3a8c9acb280d2a6cc11d1f15e31280b6aa1fc22bcbe7cb94af4316234a1aafa54b04ba3b46f62
|
7
|
+
data.tar.gz: f59236f39b298e2ab1be29202c58e9bdc36aec4a6f9b8f413251c87d7ad90cf300a620dcc6395a9e728c7c479770dad5a546c74a7f67b99461a4efad4e863b6c
|
data/lib/cnvrg/api.rb
CHANGED
@@ -17,14 +17,14 @@ module Cnvrg
|
|
17
17
|
if File.exist? home_dir+"/.cnvrg/config.yml"
|
18
18
|
config = YAML.load_file(home_dir+"/.cnvrg/config.yml")
|
19
19
|
else
|
20
|
-
return "https://cnvrg.io/api"
|
20
|
+
return "https://app.cnvrg.io/api"
|
21
21
|
end
|
22
22
|
|
23
23
|
rescue
|
24
|
-
return "https://cnvrg.io/api"
|
24
|
+
return "https://app.cnvrg.io/api"
|
25
25
|
end
|
26
26
|
if !config or config.empty? or config.to_h[:api].nil?
|
27
|
-
return "https://cnvrg.io/api"
|
27
|
+
return "https://app.cnvrg.io/api"
|
28
28
|
else
|
29
29
|
return config.to_h[:api]
|
30
30
|
end
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -2276,7 +2276,7 @@ module Cnvrg
|
|
2276
2276
|
if git_output_dir.ends_with? "/"
|
2277
2277
|
git_output_dir = git_output_dir[0..-2]
|
2278
2278
|
end
|
2279
|
-
list = @project.
|
2279
|
+
list = @project.generate_output_dir_tmp(git_output_dir)
|
2280
2280
|
spec_files_to_upload = list
|
2281
2281
|
if spec_files_to_upload.blank?
|
2282
2282
|
log_message("#{check} Project is up to date", Thor::Shell::Color::GREEN, (((options["sync"] or sync) and !direct) ? false : true))
|
@@ -2961,7 +2961,7 @@ module Cnvrg
|
|
2961
2961
|
method_option :data_query, :type => :string, :aliases => ["-q", "--query"], :default => nil
|
2962
2962
|
method_option :git_commit, :type => :string, :aliases => [ "--git_commit"], :default => nil
|
2963
2963
|
method_option :git_branch, :type => :string, :aliases => [ "--git_branch"], :default => nil
|
2964
|
-
method_option :restart_if_stuck, :type => :boolean, :aliases => ["--restart"], :default => nil
|
2964
|
+
method_option :restart_if_stuck, :type => :boolean, :aliases => ["--restart","--restart_if_stuck"], :default => nil
|
2965
2965
|
method_option :local_folders, :type => :string, :aliases => ["--local_folders"], :default => nil
|
2966
2966
|
|
2967
2967
|
def run(*cmd)
|
@@ -3003,6 +3003,7 @@ module Cnvrg
|
|
3003
3003
|
git_branch = options["git_branch"]
|
3004
3004
|
restart_if_stuck = options["restart_if_stuck"]
|
3005
3005
|
|
3006
|
+
|
3006
3007
|
options_hash = Hash[options]
|
3007
3008
|
|
3008
3009
|
if local
|
@@ -3376,6 +3377,7 @@ module Cnvrg
|
|
3376
3377
|
method_option :local_folders, :type => :string, :aliases => ["--local_folders"], :default => nil
|
3377
3378
|
|
3378
3379
|
def exec_remote(*cmd)
|
3380
|
+
|
3379
3381
|
verify_logged_in(true)
|
3380
3382
|
log_start(__method__, args, options)
|
3381
3383
|
working_dir = is_cnvrg_dir
|
@@ -3442,7 +3444,7 @@ module Cnvrg
|
|
3442
3444
|
git_branch = options["git_branch"]
|
3443
3445
|
options_hash = Hash[options]
|
3444
3446
|
local_folders_options = options["local_folders"]
|
3445
|
-
options_hash.except!("schedule", "machine_type", "image", "upload_output", "grid", "data", "data_commit",
|
3447
|
+
options_hash.except!("schedule", "machine_type", "image", "upload_output", "grid", "data", "data_commit", "title",
|
3446
3448
|
"local", "small", "medium", "large", "gpu", "gpuxl", "gpuxxl","max_time","dataset_only_tree",
|
3447
3449
|
"data_query", "git_commit","git_branch", "restart_if_stuck","local_folders" )
|
3448
3450
|
exec_options = options_hash.map {|x| "--#{x[0]}=#{x[1]}"}.flatten.join(" ")
|
@@ -3578,8 +3580,11 @@ module Cnvrg
|
|
3578
3580
|
project = Project.new(working_dir)
|
3579
3581
|
commit_to_run = options["commit"] || nil
|
3580
3582
|
|
3581
|
-
workers = options["workers"]
|
3583
|
+
workers = options["workers"]
|
3582
3584
|
begin
|
3585
|
+
if workers.blank?
|
3586
|
+
workers = 2
|
3587
|
+
end
|
3583
3588
|
num_workers = workers.to_i
|
3584
3589
|
rescue
|
3585
3590
|
log_message("Number of workers should be a number between 1 to 10", Thor::Shell::Color::RED)
|
@@ -3588,18 +3593,10 @@ module Cnvrg
|
|
3588
3593
|
file_as_input = options["file_as_input"] || false
|
3589
3594
|
|
3590
3595
|
|
3591
|
-
image = is_project_with_docker(working_dir)
|
3592
|
-
if !image or !image.is_docker
|
3593
|
-
image = Images.new(working_dir, "cnvrg")
|
3594
|
-
image_slug = image.image_slug
|
3595
|
-
else
|
3596
|
-
image_slug = image.image_slug
|
3597
|
-
end
|
3598
|
-
|
3599
3596
|
|
3600
3597
|
invoke :sync, [false], []
|
3601
3598
|
|
3602
|
-
res = project.deploy(file_to_run, function, nil, commit_to_run, instance_type,
|
3599
|
+
res = project.deploy(file_to_run, function, nil, commit_to_run, instance_type, "cnvrg", schedule, local_timestamp, num_workers, file_as_input, title)
|
3603
3600
|
|
3604
3601
|
if Cnvrg::CLI.is_response_success(res)
|
3605
3602
|
|
data/lib/cnvrg/files.rb
CHANGED
@@ -57,7 +57,6 @@ module Cnvrg
|
|
57
57
|
unless Cnvrg::CLI.is_response_success(resp, false)
|
58
58
|
raise Exception.new("Cant upload files to the server.")
|
59
59
|
end
|
60
|
-
|
61
60
|
# resolve bucket
|
62
61
|
res = resp['result']
|
63
62
|
files = res['files']
|
@@ -66,6 +65,7 @@ module Cnvrg
|
|
66
65
|
bucket = props[:bucket]
|
67
66
|
upload_options = props[:upload_options]
|
68
67
|
s3_bucket = Aws::S3::Resource.new(client: client).bucket(bucket)
|
68
|
+
|
69
69
|
#upload files
|
70
70
|
files.keys.map do |file|
|
71
71
|
# Parallel.map(files.keys, self.get_upload_options) do |file|
|
@@ -420,7 +420,6 @@ module Cnvrg
|
|
420
420
|
begin
|
421
421
|
return true if upload_resp['result']['already_exists'].present?
|
422
422
|
sts_path = upload_resp["result"]["path_sts"]
|
423
|
-
|
424
423
|
retries = 0
|
425
424
|
success= false
|
426
425
|
while !success and retries < 20
|
@@ -471,7 +470,6 @@ module Cnvrg
|
|
471
470
|
:endpoint=> endpoint,:force_path_style=> true,:ssl_verify_peer=>false,
|
472
471
|
:http_open_timeout => 60, :retry_limit => 20)
|
473
472
|
end
|
474
|
-
|
475
473
|
s3 = Aws::S3::Resource.new(client: client)
|
476
474
|
resp = s3.bucket(bucket).
|
477
475
|
object(upload_resp["result"]["path"]+"/"+File.basename(file_path)).
|
data/lib/cnvrg/project.rb
CHANGED
@@ -341,6 +341,26 @@ module Cnvrg
|
|
341
341
|
end
|
342
342
|
|
343
343
|
|
344
|
+
return upload_list
|
345
|
+
|
346
|
+
end
|
347
|
+
def generate_output_dir_tmp(output_dir)
|
348
|
+
upload_list = []
|
349
|
+
list = Dir.glob("#{output_dir}/**/*", File::FNM_DOTMATCH)
|
350
|
+
Parallel.map(list, in_threads: IDXParallelThreads) do |e|
|
351
|
+
next if e.end_with? "/."
|
352
|
+
if File.directory? e
|
353
|
+
|
354
|
+
next
|
355
|
+
else
|
356
|
+
upload_list << e
|
357
|
+
end
|
358
|
+
end
|
359
|
+
# if Dir.exists? output_dir
|
360
|
+
# upload_list << output_dir + "/"
|
361
|
+
# end
|
362
|
+
|
363
|
+
|
344
364
|
return upload_list
|
345
365
|
|
346
366
|
end
|
@@ -518,6 +538,7 @@ module Cnvrg
|
|
518
538
|
end
|
519
539
|
|
520
540
|
def deploy(file_to_run, function, input_params, commit_to_run, instance_type, image_slug, scheduling_query, local_timestamp,workers, file_input, title)
|
541
|
+
|
521
542
|
response = Cnvrg::API.request("users/#{@owner}/projects/#{@slug}/deploy", 'POST', {file_to_run: file_to_run, function: function,
|
522
543
|
image_slug: image_slug, input_params: input_params,
|
523
544
|
commit_sha1: commit_to_run,
|
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.8.
|
4
|
+
version: 0.8.2
|
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-10-
|
12
|
+
date: 2018-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|