cnvrg 2.1.3 → 2.1.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa682e9cf25c1d37b533721888ded60b3ebc397717fc904dcd7703a592dd8853
4
- data.tar.gz: bba09312bac1e44ec8b64358dead4036e173832cb605e56803bc368b8eff6dbc
3
+ metadata.gz: 414c34615497d519b8df3fc1adf597aa18bb8d05eb7466b312bbfd517f0e74aa
4
+ data.tar.gz: ddde064e3ef2f144948d1b6d1859f4daef95290dd13ae28b544569f6b16f5be0
5
5
  SHA512:
6
- metadata.gz: d8144e807411faa6c507c037309abd5e4919b317253147b6bb1eec8eaab2614ad84d32823bfc9dde405f881cefe4be9d975dd2dc21e47392c8416ddd0ed6c253
7
- data.tar.gz: 46aebd82a4901774d605f40c26aee7607a0a3c407ddf1c3cc4f91625f678e5f2f0bcb8e53c92b3c5812150a6b4b98f491e3c21adace85196d82314e35ef7646e
6
+ metadata.gz: 8d72d7b22df91d154e0313f24511ae9f6f007c077bf0f49a9329f0546ec9983833920fd567e4abfe7ab876ae2da4aae888d77840d10d7945f956d0b8e77047c1
7
+ data.tar.gz: f72cfb009f744ede0fdaec505610e32fa50ee570415cd729678c2d791b79351a891569f5ef1911920ddca242bc0354c61e6aa505252793b3345cdfdaeebe0dbc
data/Readme.md CHANGED
@@ -88,4 +88,24 @@
88
88
  * DEV-13815 - Bug: CLI - remove "cnvrg data sync" command
89
89
  ## Version v2.1.3
90
90
  2022-05-16
91
- * DEV-13981 - Bug: CLI - dataset query clone stuck at 50% then "Killed"
91
+ * DEV-13981 - Bug: CLI - dataset query clone stuck at 50% then "Killed"
92
+ ## Version v2.1.4
93
+ 2022-05-22
94
+ * DEV-14182 - Bug: Cli - hide 'data upload' command
95
+ ## Version v2.1.5
96
+ 2022-07-31
97
+ * DEV-14244 - Bug: CLI - "failed to upload ongoing stats" due to NaN in float
98
+ * DEV-14633 - Bug: End sync did not complete, causing the experiment to get stuck in "terminating"
99
+ ## Version v2.1.6
100
+ 2022-08-09
101
+ * DEV-14682 - Bug: git-Walki: CLI/SDK experiments goes into debug mode for Github+SSH integrated projects
102
+ ## Version v2.1.7
103
+ 2022-08-24
104
+ * DEV-15229 - Bug: CLI - warnings from faraday gem when running any CLI command
105
+ ## Version v2.1.8
106
+ 2022-09-04
107
+ * DEV-15473 - Bug: CLI - Errors while cloning a project that has file containing spaces in their names
108
+ ## Version v2.1.9
109
+ 2022-09-06
110
+ * DEV-15423 - Bug: Workspace - Jupyter process gets killed
111
+ * DEV-15451 - Bug: CLI - sync error "undefined method `encode' for nil:NilClass" on GCP storage
data/cnvrg.gemspec CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_runtime_dependency 'ffi', '~> 1.9', '>= 1.9.10'
29
29
  spec.add_runtime_dependency 'mimemagic', '~> 0.3.1', '>=0.3.7'
30
30
  spec.add_runtime_dependency 'faraday', '~> 0.15.2'
31
+ spec.add_runtime_dependency 'warning', '~> 1.3.0'
31
32
  spec.add_runtime_dependency 'netrc', '~> 0.11.0'
32
33
  spec.add_runtime_dependency 'open4', '~> 1.3', '>= 1.3.4'
33
34
  spec.add_runtime_dependency 'highline', '~> 1.7', '>= 1.7.8'
data/lib/cnvrg/cli.rb CHANGED
@@ -1848,7 +1848,7 @@ module Cnvrg
1848
1848
  log_start(__method__, args, options)
1849
1849
  project_home = Dir.pwd
1850
1850
  soft = options["soft"] || false
1851
- Project.stop_if_project_present(project_home, slug) if soft
1851
+ Project.stop_if_project_present(project_home, slug, owner) if soft
1852
1852
  clone_resp = Project.clone_dir_remote(slug, owner, slug,true)
1853
1853
  exit 1 if not clone_resp
1854
1854
  idx_status = Project.new(get_project_home).generate_idx(files:[])
@@ -1918,7 +1918,7 @@ module Cnvrg
1918
1918
  clone_resp = false
1919
1919
  project_home = Dir.pwd
1920
1920
 
1921
- Project.stop_if_project_present(project_home, project_name) if soft
1921
+ Project.stop_if_project_present(project_home, project_name, owner) if soft
1922
1922
 
1923
1923
  if remote and !git
1924
1924
  clone_resp = Project.clone_dir_remote(slug, owner, project_name,git)
@@ -2088,6 +2088,8 @@ module Cnvrg
2088
2088
  method_option :message, :type => :string, :aliases => ["--message"], :desc => "create commit with message", :default => nil
2089
2089
 
2090
2090
  def upload_data_new(new_branch, verbose, sync, force, tags, chunk_size, message:nil, total_deleted: 0, total_downloaded: 0)
2091
+ log_message("This method is deprecated, please use 'data put' instead. for more info visit our docs: https://app.cnvrg.io/docs/cli/install.html#upload-files-to-a-dataset", Thor::Shell::Color::BLUE, !options["verbose"])
2092
+ return
2091
2093
  begin
2092
2094
  commit, files_list = invoke :start_commit_data,[], :new_branch=> new_branch, :direct=>false, :force =>force, :chunk_size => chunk_size, :message => message
2093
2095
  files_to_upload, upload_errors = invoke :upload_data_files,[commit, files_list: files_list],:new_branch=>new_branch, :verbose =>verbose, :force =>force, :sync =>sync, :chunk_size => chunk_size
@@ -4731,8 +4733,14 @@ module Cnvrg
4731
4733
  end
4732
4734
  end
4733
4735
  else
4734
- timestamp, value = data_result&.first&.dig('value')
4735
- stat_value = value.present? ? ("%.2f" % value) : 0 # converting 34.685929244444445 to 34.69
4736
+ begin
4737
+ timestamp, value = data_result&.first&.dig('value')
4738
+ stat_value = value.present? ? ("%.2f" % value) : 0 # converting 34.685929244444445 to 34.69
4739
+ rescue => e
4740
+ Cnvrg::Logger.log_info("Failed converting string into float with error: #{e.message}")
4741
+ Cnvrg::Logger.log_error(e)
4742
+ stat_value = 0
4743
+ end
4736
4744
  stat_value = stat_value.to_i == stat_value.to_f ? stat_value.to_i : stat_value.to_f # converting 34.00 to 34
4737
4745
  if query_name.include? 'block'
4738
4746
  stats['block_io'] = {} if stats['block_io'].blank?
data/lib/cnvrg/data.rb CHANGED
@@ -81,7 +81,7 @@ module Cnvrg
81
81
  end
82
82
  end
83
83
 
84
- desc "data upload", "Upload files from local dataset directory to remote server"
84
+ desc "data upload", "Upload files from local dataset directory to remote server", :hide => true
85
85
  method_option :verbose, :type => :boolean, :aliases => ["-v"], :default => false
86
86
  method_option :new_branch, :type => :boolean, :aliases => ["-nb"], :desc => "create new branch of commits"
87
87
  method_option :force, :type => :boolean, :aliases => ["-f","--force"], :default => false
@@ -15,15 +15,13 @@ module Cnvrg
15
15
 
16
16
  def download(storage_path, local_path, decrypt: true)
17
17
  prepare_download(local_path)
18
-
19
18
  storage_path = Cnvrg::Helpers.decrypt(@key, @iv, storage_path) if decrypt
20
19
 
21
20
  # We generate a temp uri in order to stream the file instead of using "get_blob" that overflows memory
22
21
  uri = client.send(:blob_uri, @container, storage_path)
23
22
 
24
- generator = Azure::Storage::Common::Core::Auth::SharedAccessSignature.new(@account_name, @access_key)
25
23
 
26
- expiring_url = generator.signed_uri(
24
+ expiring_url = self.signed_uri_custom(
27
25
  uri,
28
26
  false,
29
27
  service: 'b',
@@ -32,12 +30,32 @@ module Cnvrg
32
30
  start: (Time.now - (5 * 60)).utc.iso8601, # start 5 minutes ago
33
31
  expiry: (Time.now + 60 * 60 * 2).utc.iso8601 # expire in 2 hours
34
32
  )
35
-
36
33
  # Stream the file without loading it all into memory
37
34
  download = open(expiring_url)
38
35
  IO.copy_stream(download, local_path)
39
36
  end
40
37
 
38
+ def signed_uri_custom(uri, use_account_sas, options)
39
+ # url sent to generate_service_sas_token should be DECODED (file names with spaces should not be encoded with %20)
40
+ url = URI.decode(uri.path)
41
+ generator = Azure::Storage::Common::Core::Auth::SharedAccessSignature.new(@account_name, @access_key)
42
+
43
+ CGI::parse(uri.query || "").inject({}) { |memo, (k, v)| memo[k.to_sym] = v; memo }
44
+
45
+ if options[:service] == (nil) && uri.host != (nil)
46
+ host_splits = uri.host.split(".")
47
+ options[:service] = host_splits[1].chr if host_splits.length > 1 && host_splits[0] == @account_name
48
+ end
49
+
50
+ sas_params = if use_account_sas
51
+ generator.generate_account_sas_token(options)
52
+ else
53
+ generator.generate_service_sas_token(url, options)
54
+ end
55
+
56
+ URI.parse(uri.to_s + (uri.query.nil? ? "?" : "&") + sas_params)
57
+ end
58
+
41
59
  def upload(storage_path, local_path)
42
60
  begin
43
61
  client.create_block_blob(@container, storage_path, File.open(local_path, "rb"))
@@ -6,7 +6,7 @@ module Cnvrg
6
6
  class GcpClient < Client
7
7
  def initialize(project_id: nil, credentials: nil, bucket_name: nil, sts: nil)
8
8
  @key, @iv = extract_key_iv(sts)
9
- @project_id = Cnvrg::Helpers.decrypt(@key, @iv, project_id)
9
+ @project_id = Cnvrg::Helpers.decrypt(@key, @iv, project_id) if project_id.present?
10
10
  @credentials_path = Cnvrg::Helpers.decrypt(@key, @iv, credentials)
11
11
  @tempfile = nil
12
12
  @bucket_name = Cnvrg::Helpers.decrypt(@key, @iv, bucket_name)
@@ -22,6 +22,7 @@ class Cnvrg::Helpers::Agent
22
22
  @slug = slug
23
23
  @files_exist = files_exist
24
24
  @container_name = container_name
25
+ @execute_command_completed = false
25
26
  @is_new_main = !ENV["MAIN_CONTAINER_PORT"].blank?
26
27
  @main_name = @is_new_main ? "main" : "slave"
27
28
  @run_in_main = @container_name.downcase == @main_name
@@ -79,6 +80,7 @@ class Cnvrg::Helpers::Agent
79
80
  command_status = Status::ABORTED
80
81
  @exit_status = 127
81
82
  end
83
+ @execute_command_completed = true
82
84
  finish_log = "Command: #{@command} with slug: #{@slug} finished"
83
85
  finish_log += " after #{@real_execution_retries} retries" if @real_execution_retries > 0
84
86
  log_internal(finish_log)
@@ -97,7 +99,7 @@ class Cnvrg::Helpers::Agent
97
99
 
98
100
  def periodic_thread
99
101
  Thread.new do
100
- while @exit_status.blank?
102
+ while !@execute_command_completed
101
103
  Thread.exit if @log_interval.blank?
102
104
  sleep(@log_interval)
103
105
  send_logs
@@ -179,11 +181,17 @@ class Cnvrg::Helpers::Agent
179
181
  end
180
182
  end
181
183
  @exit_status = $?.exitstatus
184
+ rescue NoMethodError => e
185
+ log_internal("No Method Error: #{e}", level: LogLevel::ERROR)
186
+ @exit_status = 129
182
187
  rescue Timeout::Error
183
188
  Process.kill(0, @pid)
184
189
  @errors << {log: "Command timed out!", timestamp: Time.now}
185
190
  log_internal("Command timed out!", level: LogLevel::ERROR)
186
191
  @exit_status = 124
192
+ rescue => e
193
+ log_internal("Error: #{e}", level: LogLevel::ERROR)
194
+ @exit_status = 129
187
195
  ensure
188
196
  retry_command if @retries != 0 and @exit_status !=0
189
197
  @exit_status
data/lib/cnvrg/project.rb CHANGED
@@ -829,12 +829,12 @@ module Cnvrg
829
829
  Cnvrg::API.request("users/#{@owner}/projects/#{@slug}/jobs/#{job_type.underscore}/#{job_id}/set_started", "POST", {job_type: job_type, job_id: job_id})
830
830
  end
831
831
 
832
- def self.stop_if_project_present(project_home, project_name)
832
+ def self.stop_if_project_present(project_home, project_name, owner)
833
833
  cli = Cnvrg::CLI.new()
834
834
  config = YAML.load_file(project_home + "/.cnvrg/config.yml")
835
835
  local_commit = YAML.load_file(project_home + "/.cnvrg/idx.yml")[:commit] rescue nil
836
836
  return if local_commit.blank?
837
- if config[:project_name] == project_name
837
+ if config[:project_name] == project_name && config[:owner] == owner
838
838
  cli.log_message("Project already present, clone aborted")
839
839
  exit(0)
840
840
  end
data/lib/cnvrg/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cnvrg
2
- VERSION = '2.1.3'
2
+ VERSION = '2.1.9'
3
3
  end
data/lib/cnvrg.rb CHANGED
@@ -1,3 +1,7 @@
1
+ require 'warning'
2
+ Warning.ignore(/.*::CompositeIO is deprecated.*/)
3
+ Warning.ignore(/.*::Parts is deprecated.*/)
4
+ Warning.ignore(/.*::UploadIO is deprecated.*/)
1
5
  require 'rubygems'
2
6
  require 'cnvrg/version'
3
7
  require 'cnvrg/cli'
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: 2.1.3
4
+ version: 2.1.9
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: 2022-05-16 00:00:00.000000000 Z
13
+ date: 2022-09-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 0.15.2
153
+ - !ruby/object:Gem::Dependency
154
+ name: warning
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 1.3.0
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 1.3.0
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: netrc
155
169
  requirement: !ruby/object:Gem::Requirement