cnvrg 1.6.33 → 1.6.35

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: 465c50d73c84ef9a768c647926ab576225b5c4344db62b815f64685340b29e38
4
- data.tar.gz: 6bf6610502b0b43c94d9cf5036b509e39da10210dc1cf6eacadb4dce1c837f60
3
+ metadata.gz: 5f90f59c9a970e96f5ac718fa295cc2ce4f81ff143d8d9f8848b039a4ecdd004
4
+ data.tar.gz: 66beb8643ccbe900863b674b20f6138d69380cd0719deba77b15ce836c14d3dd
5
5
  SHA512:
6
- metadata.gz: 06fc439571eb477075c79d816b16409eb33b3171d6ebb710cce394e44ab5c37ca0da02d370a29c2957169c6a779f37b29415d8ee7af576cd7a6cf975de11dfe0
7
- data.tar.gz: 5c7f72eff0112c158b3048fde389a75108151f9b527e017782c73229434180f280308d2e85d52eb765f4cba356232bcd96844aaafed0335d11f455aa73ba486b
6
+ metadata.gz: 771c2fc62849c1d33363d49aa555ffd7408ef3f821dc3b3106c5c94004ab1076f4d96574b12af92b80f5a7fe8ca38270875cd06801edd26145d6c7eaef249266
7
+ data.tar.gz: 53fd6f5f3653ed67777022e9c50f9b042f2a4b35739e23a28ff4777c5480c62e227b62633cd7b34ff44bf19a8d1ed2268555194a5650f2c103578960f2d0bf5f
@@ -1184,7 +1184,7 @@ module Cnvrg
1184
1184
  end
1185
1185
 
1186
1186
  desc '', '', :hide => true
1187
- def data_put(dataset_url, files: [], dir: '', commit: '', chunk_size: 1000)
1187
+ def data_put(dataset_url, files: [], dir: '', commit: '', chunk_size: 1000, message: nil)
1188
1188
  begin
1189
1189
  verify_logged_in(false)
1190
1190
  log_start(__method__, args, options)
@@ -1204,7 +1204,7 @@ module Cnvrg
1204
1204
  log_message("Uploading #{@files.size} files", Thor::Shell::Color::GREEN)
1205
1205
  number_of_chunks = (@files.size.to_f / chunk_size).ceil
1206
1206
  if commit.blank?
1207
- response = @datafiles.start_commit(false, true, chunks: number_of_chunks)
1207
+ response = @datafiles.start_commit(false, true, chunks: number_of_chunks, message: message )
1208
1208
  unless response #means we failed in the start commit.
1209
1209
  raise SignalException.new(1, "Cant put files into dataset, check the dataset id")
1210
1210
  end
@@ -1837,8 +1837,6 @@ module Cnvrg
1837
1837
  end
1838
1838
  clone_resp = Project.clone_dir(slug, owner, project_name,git)
1839
1839
  project_home = Dir.pwd + "/" + project_name
1840
-
1841
-
1842
1840
  end
1843
1841
 
1844
1842
  if clone_resp
@@ -186,11 +186,14 @@ module Cnvrg
186
186
  desc 'data put DATASET_URL FILES_PREFIX', 'Upload selected files from local dataset directory to remote server'
187
187
  method_option :dir, :type => :string, :aliases => ["-d", "--dir"], :default => ''
188
188
  method_option :commit, :type => :string, :aliases => ["-c", "--commit"], :default => ''
189
+ method_option :message, :type => :string, :aliases => ["--message"], :desc => "create commit with message", :default => nil
189
190
  def put(dataset_url, *files)
190
191
  cli = Cnvrg::CLI.new()
191
192
  dir = options[:dir]
192
193
  commit = options[:commit]
193
- cli.data_put(dataset_url, files: files, dir: dir, commit: commit)
194
+ message = options[:message]
195
+
196
+ cli.data_put(dataset_url, files: files, dir: dir, commit: commit, message: message)
194
197
  end
195
198
 
196
199
  desc 'data clone_query --query=QUERY_SLUG DATASET_URL', 'Clone dataset with specific query'
@@ -20,6 +20,15 @@ module Cnvrg
20
20
  @dataset = dataset
21
21
  @base_resource = "users/#{owner}/datasets/#{dataset_slug}/"
22
22
  @downloader = @dataset.get_storage_client
23
+ @token_issue_time = Time.current
24
+ end
25
+
26
+ def refresh_storage_token
27
+ current_time = Time.current
28
+ if current_time - @token_issue_time > 3.hours
29
+ @downloader = @dataset.get_storage_client
30
+ @token_issue_time = Time.current
31
+ end
23
32
  end
24
33
 
25
34
  def check_file_sha1(filename, org_sha1, tag: 'conflict')
@@ -117,6 +126,7 @@ module Cnvrg
117
126
  def upload_multiple_files(commit_sha1, tree, threads: ParallelThreads, force: false, new_branch: false, prefix: '', partial_commit: nil, total: nil)
118
127
  begin
119
128
  Cnvrg::Logger.log_info("Sending Upload Files request")
129
+ refresh_storage_token
120
130
  error = nil
121
131
  upload_resp = nil
122
132
  10.times do
@@ -1007,6 +1017,7 @@ module Cnvrg
1007
1017
 
1008
1018
  def download_multiple_files_s3(files, project_home, conflict: false, progressbar: nil, read_only:false)
1009
1019
  begin
1020
+ refresh_storage_token
1010
1021
  parallel_options = {
1011
1022
  in_threads: ParallelThreads,
1012
1023
  isolation: true
@@ -27,8 +27,16 @@ module Cnvrg
27
27
  @custom_progess = false
28
28
  @cli = cli
29
29
  @options = options
30
+ @token_issue_time = Time.current
30
31
  end
31
32
 
33
+ def refresh_storage_token
34
+ current_time = Time.current
35
+ if current_time - @token_issue_time > 3.hours
36
+ @client = @project.get_storage_client
37
+ @token_issue_time = Time.current
38
+ end
39
+ end
32
40
 
33
41
  def self.valid_file_name?(fullpath)
34
42
  VALID_FILE_NAME.match(fullpath).blank?
@@ -97,7 +105,13 @@ module Cnvrg
97
105
  files = res['files']
98
106
 
99
107
  #upload files
108
+ token_mutex = Mutex.new
100
109
  blob_ids = Parallel.map(files.keys, in_threads: ParallelThreads) do |file|
110
+
111
+ token_mutex.synchronize {
112
+ refresh_storage_token
113
+ }
114
+
101
115
  begin
102
116
  Cnvrg::Helpers.try_until_success{self.upload_single_file(files[file].merge(files_list[file]))}
103
117
  rescue => e
@@ -721,8 +735,15 @@ module Cnvrg
721
735
  in_threads: Cnvrg::Helpers.parallel_threads,
722
736
  isolation: true
723
737
  }
738
+
739
+ token_mutex = Mutex.new
740
+
724
741
  Parallel.map(files["keys"], parallel_options) do |f|
725
742
 
743
+ token_mutex.synchronize {
744
+ refresh_storage_token
745
+ }
746
+
726
747
  file_path = f["name"]
727
748
  if file_path.end_with? "/"
728
749
  # dir
@@ -1,3 +1,3 @@
1
1
  module Cnvrg
2
- VERSION = '1.6.33'
2
+ VERSION = '1.6.35'
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.6.33
4
+ version: 1.6.35
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: 2020-05-03 00:00:00.000000000 Z
13
+ date: 2020-06-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -477,7 +477,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
477
477
  - !ruby/object:Gem::Version
478
478
  version: '0'
479
479
  requirements: []
480
- rubygems_version: 3.0.4
480
+ rubygems_version: 3.1.2
481
481
  signing_key:
482
482
  specification_version: 4
483
483
  summary: A CLI tool for interacting with cnvrg.io.