cnvrg 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cec8aad47272b69a9aa02c6b1d89837c7465d818
4
- data.tar.gz: 6a5ce18de19a527f6dd48090e73faab1eb7b9f22
3
+ metadata.gz: 4fa83df811914a5ed726898d8c28a9881f9829a6
4
+ data.tar.gz: 8d628f3b5239d41f8e3bc34678183aa52c357c32
5
5
  SHA512:
6
- metadata.gz: 12c9b8b83bb8c658262b2e2a764868eb46fc8e9c9fdd210ac238260342c54671b8b2c0f81b6657eda00b69cd366a55d4aebb09873e1b49e2b858de1b132f4c90
7
- data.tar.gz: a3a57ce1f0537f6b6cadc5ab3ee8ad00b60c8dc01742433aa25ba6c1c5fd4264321cc1b181149d04dd6d5ab9d8d596808e0ba9c74fe12917b85b1ca469b27881
6
+ metadata.gz: d7c1fb5ecff1dc09e06394926cc6fe4882b2bd46539057e7610353a3b91bba30bf38acd772467788ab3e45aaa7a9966febfeae90191d23354208546aac26d99e
7
+ data.tar.gz: 6a563fabb2eaddefb3aae9108bbae6b6ed4fd2f95142a570db87da4d8580b53b327fbfbc43f72fa6348c89f410fd07ada5b1387a7f28f4cf16b346f6742643ee
@@ -26,6 +26,7 @@ module Cnvrg
26
26
  end
27
27
 
28
28
  def upload_docker_image(image_path, image_name,workdir, user, description, is_gpu )
29
+ begin
29
30
  if image_name.present? and image_name.include? ":"
30
31
  image_split = image_name.split(":")
31
32
  image_name = image_split[0]
@@ -40,7 +41,7 @@ module Cnvrg
40
41
  end
41
42
  if !File.exist? image_path
42
43
  Cnvrg::Logger.log_info("image_path: #{image_path} was not found")
43
- return
44
+ return false
44
45
  end
45
46
  is_dockerfile = (!image_path.end_with? ".tar") ? true : false
46
47
  file_name = File.basename image_path
@@ -48,18 +49,16 @@ module Cnvrg
48
49
  mime_type = MimeMagic.by_path(image_path)
49
50
  content_type = mime_type.present? ? mime_type.type : "application/x-tar"
50
51
 
51
- image_res = Cnvrg::API.request("users/#{@owner}/images/upload" , 'POST', {image_name: image_name, image_tag: image_tag,
52
+ image_res = Cnvrg::API.request("users/#{@owner}/images/upload" , 'POST_FILE', {image_name: image_name, image_tag: image_tag,
52
53
  workdir: workdir, user: user, description:description, is_gpu:is_gpu,
53
- file_name: file_name,
54
+ file_name: file_name,relative_path:image_path,
54
55
  file_size: file_size, file_content_type: content_type, is_dockerfile: is_dockerfile
55
56
  })
56
- Cnvrg::CLI.is_response_success(image_res, true
57
- )
57
+ Cnvrg::CLI.is_response_success(image_res, true)
58
58
 
59
59
  path = image_res["result"]["path"]
60
60
  image_id = image_res["result"]["image_id"]
61
61
 
62
-
63
62
  props = Cnvrg::Helpers.get_s3_props(image_res["result"])
64
63
  if props.is_a? Cnvrg::Result
65
64
  return false
@@ -68,13 +67,17 @@ module Cnvrg
68
67
  client = props[:client]
69
68
  upload_options = props[:upload_options]
70
69
  bucket = Aws::S3::Resource.new(client: client).bucket(props[:bucket])
71
-
72
70
  resp = bucket.object(path).
73
71
  upload_file(image_path, upload_options)
74
72
  unless resp
75
73
  raise Exception.new("Cant upload #{image_path}")
74
+ return false
76
75
  end
77
76
  return save_docker_image(image_id)
77
+ rescue => e
78
+ return false
79
+ end
80
+
78
81
 
79
82
 
80
83
  end
@@ -4857,7 +4857,7 @@ module Cnvrg
4857
4857
  method_option :gpu, :type => :boolean, :aliases => ["-g","--gpu"], :default => false
4858
4858
  def upload_image(image_name,image_path)
4859
4859
  begin
4860
- verify_logged_in(true)
4860
+ verify_logged_in(false)
4861
4861
  log_start(__method__, args, options)
4862
4862
 
4863
4863
  @image = Cnvrg::Images.new()
@@ -1,4 +1,4 @@
1
1
  module Cnvrg
2
- VERSION = '0.9.1'
2
+ VERSION = '0.9.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: 0.9.1
4
+ version: 0.9.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-11-27 00:00:00.000000000 Z
12
+ date: 2018-11-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -439,7 +439,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
439
439
  version: '0'
440
440
  requirements: []
441
441
  rubyforge_project:
442
- rubygems_version: 2.6.12
442
+ rubygems_version: 2.6.14
443
443
  signing_key:
444
444
  specification_version: 4
445
445
  summary: A CLI tool for interacting with cnvrg.io.