cnvrg 1.11.13 → 1.11.21

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
  SHA256:
3
- metadata.gz: 74c9b6b821c1d0fadae87a6b17579fa43a445fb0166a973bb14f686d778109e5
4
- data.tar.gz: 525cae9497069129defa5c02995d04548adf4155e70e2ccf5ffe4f23bd883ed2
3
+ metadata.gz: bc1bc67b5f62516c87e90a9b71d7d4921236eb8c13446b0c8ddac44ef9cf8544
4
+ data.tar.gz: '09b88539fc1fb041151d7fb1ec9931d0ddccc6e7cc50f958467d6e9fb976ba5d'
5
5
  SHA512:
6
- metadata.gz: 736ae2e6aa54cdd18ff40d0a196cf6a10c764eaca2cc651fa4c2816b671b1d84bdd5d2329dea01082ab4175a95223797a3904cfa712aca51a07b6c13f63b95ab
7
- data.tar.gz: bf58276b9169bc539f8d505b7482b5e9c40959e2773d1b08a323b86fd5acf9aa729f34390f56e1c3e854e9deb5d252cb4ff7f242fedba59f4ca4152c2d4f7cf3
6
+ metadata.gz: b7206c5c43fec47c6519e3fa9c798cbef0232ae0d9d70e708499d2312bbd5af802d6fc62e3b02f0f137f6322cd3486848fd9effbcbcca521171062ad22830e27
7
+ data.tar.gz: 27905ef2f218a241db92e78533390dc0b3b3fa6aa8242a925efc106eacf43d2adc11fdfc12f978ce1155fa6e1948ab9f98026ca163cb57db3729ee6080b15481
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency 'rspec', '~> 3.0'
24
24
  spec.add_development_dependency 'vcr', '~> 3.0'
25
25
  spec.add_development_dependency 'aruba'
26
- spec.add_development_dependency 'pry'
27
-
26
+ spec.add_development_dependency 'pry'
27
+
28
28
  spec.add_runtime_dependency 'mimemagic', '~> 0.3.1','>=0.3.2'
29
29
  spec.add_runtime_dependency 'faraday', '~> 0.15.2'
30
30
  spec.add_runtime_dependency 'netrc', '~> 0.11.0'
@@ -3323,7 +3323,7 @@ module Cnvrg
3323
3323
  real: real_time
3324
3324
  }
3325
3325
  if print_log
3326
- puts line
3326
+ puts({log: line, timestamp: Time.now, exp_logs: true}.to_json)
3327
3327
  end
3328
3328
  log << cur_log
3329
3329
  if log.size >= 10
@@ -43,6 +43,8 @@ module Cnvrg
43
43
  def verify_files_exists(files)
44
44
  paths = []
45
45
  files.each do |file|
46
+ # dir shouldnt have ending slash.
47
+ file = file[0..-2] if file.end_with? '/'
46
48
  if File.exists? file
47
49
  if File.directory? file
48
50
  paths += Dir.glob("#{file}/**/*")
@@ -17,7 +17,9 @@ module Cnvrg
17
17
  count = 0
18
18
  begin
19
19
  count += 1
20
- sts = open(sts_path, {ssl_verify_mode: 0}).read rescue nil
20
+ sts_file = open(sts_path, {ssl_verify_mode: 0})
21
+ sts = sts_file.read
22
+ sts.split("\n")
21
23
  rescue => e
22
24
  backoff_time_seconds = backoff_time(count)
23
25
  sleep backoff_time_seconds
@@ -25,7 +27,6 @@ module Cnvrg
25
27
  retry if count <= 20
26
28
  raise StandardError.new("Cant access storage: #{e.message}")
27
29
  end
28
- sts.split("\n")
29
30
  end
30
31
 
31
32
  def cut_prefix(prefix, file)
@@ -733,7 +733,7 @@ module Cnvrg
733
733
  unless Cnvrg::CLI.is_response_success(res, false)
734
734
  raise SignalException.new("Cant download files from the server.")
735
735
  end
736
- self.download_multpile_files_s3(res['result'], @project_home, postfix: postfix, progress: progress, threads: threads)
736
+ self.download_multiple_files_s3(res['result'], @project_home, postfix: postfix, progress: progress, threads: threads)
737
737
  end
738
738
 
739
739
 
@@ -750,7 +750,8 @@ module Cnvrg
750
750
  conflicted.each{|file| self.delete_conflict(file); progress.progress += 1 if progress.present?}
751
751
  end
752
752
 
753
- def download_multpile_files_s3(files, project_home, postfix: '', progress: nil, threads: 15)
753
+ def download_multiple_files_s3(files, project_home, postfix: '', progress: nil, threads: 15)
754
+ cli = Cnvrg::CLI.new()
754
755
  begin
755
756
  props = {}
756
757
  client = props[:client]
@@ -774,14 +775,19 @@ module Cnvrg
774
775
  file_path = f["name"]
775
776
  if file_path.end_with? "/"
776
777
  # dir
777
- if download_dir(file_path, file_path, project_home)
778
- download_succ_count += 1
779
- else
780
- return Cnvrg::Result.new(false,"Could not create directory: #{file_path}")
781
- raise Parallel::Kill
778
+ begin
779
+ if download_dir(file_path, file_path, project_home)
780
+ download_succ_count += 1
781
+ else
782
+ raise StandardError.new("Could not create directory #{file_path}.")
783
+ end
784
+ rescue => e
785
+ cli.log_message("Could not create directory #{file_path}. error: #{e.message}", Thor::Shell::Color::RED)
786
+ raise e
782
787
  end
783
788
  else
784
789
  file_path += postfix
790
+
785
791
  # blob
786
792
  begin
787
793
  if not File.exists?(project_home+"/"+File.dirname(file_path))
@@ -790,28 +796,30 @@ module Cnvrg
790
796
  local_path = project_home+"/"+file_path
791
797
  storage_path = f["path"]
792
798
  @client.safe_download(storage_path, local_path)
793
- progress.progress += 1 if progress.present?
794
- download_succ_count += 1
795
799
  rescue => e
796
- return Cnvrg::Result.new(false,"Could not create file: #{file_path}", e.message, e.backtrace)
797
- raise Parallel::Kill
800
+ cli.log_message("Could not download file #{file_path}. error: #{e.message}", Thor::Shell::Color::RED)
801
+ raise e
798
802
  end
799
803
 
800
-
801
-
804
+ # progressbar can throw an exception so we no longer trust it!
805
+ begin
806
+ progress.progress += 1 if progress.present?
807
+ rescue
808
+ nil
809
+ ensure
810
+ download_succ_count += 1
811
+ end
802
812
  end
803
813
  end
804
814
  if download_succ_count == files["keys"].size
805
815
  return Cnvrg::Result.new(true,"Done.\nDownloaded #{download_succ_count} files")
806
816
  end
807
817
  rescue => e
808
- return Cnvrg::Result.new(false,"Could not download some files", e.message, e.backtrace)
818
+ cli.log_error(e)
819
+ raise e
809
820
  end
810
-
811
-
812
-
813
-
814
821
  end
822
+
815
823
  def download_file(absolute_path, relative_path, project_home, conflict=false)
816
824
  res = Cnvrg::API.request(@base_resource + "download_file", 'POST', {absolute_path: absolute_path, relative_path: relative_path})
817
825
  Cnvrg::CLI.is_response_success(res, false)
@@ -62,7 +62,7 @@ module Cnvrg
62
62
  resp = Cnvrg::API.request(url, 'POST', {flow_version: recipe.to_json}) || {}
63
63
  if resp["status"] == 200
64
64
  return [Flows.new(resp["flow_version"]["flow_id"], project: project), resp["flow_version"]["id"]]
65
- elsif resp["status"] == 400
65
+ elsif resp["status"].between?(400,499)
66
66
  raise StandardError.new(resp["message"])
67
67
  end
68
68
  raise StandardError.new("Can't create new flow")
@@ -170,7 +170,7 @@ class Cnvrg::Helpers::Executer
170
170
  next
171
171
  end
172
172
  cmd = @commands_q.pop.symbolize_keys
173
- comman d_json = Cnvrg::API.request([activity_url, "commands", cmd[:slug]].join('/'), "GET")
173
+ command_json = Cnvrg::API.request([activity_url, "commands", cmd[:slug]].join('/'), "GET")
174
174
 
175
175
  cmd_status = command_json["status"] rescue ""
176
176
 
@@ -1,3 +1,3 @@
1
1
  module Cnvrg
2
- VERSION = '1.11.13'
2
+ VERSION = '1.11.21'
3
3
  end
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.11.13
4
+ version: 1.11.21
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: 2021-01-18 00:00:00.000000000 Z
13
+ date: 2021-02-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -453,7 +453,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
453
453
  - !ruby/object:Gem::Version
454
454
  version: '0'
455
455
  requirements: []
456
- rubygems_version: 3.1.2
456
+ rubygems_version: 3.0.9
457
457
  signing_key:
458
458
  specification_version: 4
459
459
  summary: A CLI tool for interacting with cnvrg.io.