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 +4 -4
- data/cnvrg.gemspec +2 -2
- data/lib/cnvrg/cli.rb +1 -1
- data/lib/cnvrg/datafiles.rb +2 -0
- data/lib/cnvrg/downloader/client.rb +3 -2
- data/lib/cnvrg/files.rb +26 -18
- data/lib/cnvrg/flow.rb +1 -1
- data/lib/cnvrg/helpers/executer.rb +1 -1
- 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: bc1bc67b5f62516c87e90a9b71d7d4921236eb8c13446b0c8ddac44ef9cf8544
|
4
|
+
data.tar.gz: '09b88539fc1fb041151d7fb1ec9931d0ddccc6e7cc50f958467d6e9fb976ba5d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7206c5c43fec47c6519e3fa9c798cbef0232ae0d9d70e708499d2312bbd5af802d6fc62e3b02f0f137f6322cd3486848fd9effbcbcca521171062ad22830e27
|
7
|
+
data.tar.gz: 27905ef2f218a241db92e78533390dc0b3b3fa6aa8242a925efc106eacf43d2adc11fdfc12f978ce1155fa6e1948ab9f98026ca163cb57db3729ee6080b15481
|
data/cnvrg.gemspec
CHANGED
@@ -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'
|
data/lib/cnvrg/cli.rb
CHANGED
data/lib/cnvrg/datafiles.rb
CHANGED
@@ -17,7 +17,9 @@ module Cnvrg
|
|
17
17
|
count = 0
|
18
18
|
begin
|
19
19
|
count += 1
|
20
|
-
|
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)
|
data/lib/cnvrg/files.rb
CHANGED
@@ -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.
|
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
|
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
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
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
|
-
|
797
|
-
raise
|
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
|
-
|
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)
|
data/lib/cnvrg/flow.rb
CHANGED
@@ -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"]
|
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
|
-
|
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
|
|
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.11.
|
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
|
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.
|
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.
|