cnvrg 2.0.17 → 2.1.3
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 +4 -4
- data/Readme.md +18 -1
- data/lib/cnvrg/cli.rb +13 -9
- data/lib/cnvrg/data.rb +1 -1
- data/lib/cnvrg/datafiles.rb +13 -2
- data/lib/cnvrg/downloader/clients/azure_client.rb +22 -3
- data/lib/cnvrg/files.rb +1 -1
- data/lib/cnvrg/helpers/agent.rb +0 -1
- data/lib/cnvrg/helpers/executer.rb +32 -9
- data/lib/cnvrg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa682e9cf25c1d37b533721888ded60b3ebc397717fc904dcd7703a592dd8853
|
|
4
|
+
data.tar.gz: bba09312bac1e44ec8b64358dead4036e173832cb605e56803bc368b8eff6dbc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8144e807411faa6c507c037309abd5e4919b317253147b6bb1eec8eaab2614ad84d32823bfc9dde405f881cefe4be9d975dd2dc21e47392c8416ddd0ed6c253
|
|
7
|
+
data.tar.gz: 46aebd82a4901774d605f40c26aee7607a0a3c407ddf1c3cc4f91625f678e5f2f0bcb8e53c92b3c5812150a6b4b98f491e3c21adace85196d82314e35ef7646e
|
data/Readme.md
CHANGED
|
@@ -71,4 +71,21 @@
|
|
|
71
71
|
* DEV-12316 - Improvement: cli login should identify saas users automatically
|
|
72
72
|
## Version v2.0.17
|
|
73
73
|
2021-12-19
|
|
74
|
-
* DEV-10581 - Bug: CLI - getting 404 response in "cnvrg set_default_owner"
|
|
74
|
+
* DEV-10581 - Bug: CLI - getting 404 response in "cnvrg set_default_owner"
|
|
75
|
+
## Version v2.0.18
|
|
76
|
+
2022-01-31
|
|
77
|
+
* DEV-12637 - Bug: Dataset - creating file from CLI/SDK in a folder with + sign, replaces + with space AND creates 2 folders
|
|
78
|
+
## Version v2.0.19
|
|
79
|
+
2022-02-22
|
|
80
|
+
* DEV-13271 - Bug: CLI - on upload folders in working dir containing .cnvrg, dir not uploading - dir is on .cnvrgignore
|
|
81
|
+
## Version v2.0.20
|
|
82
|
+
2022-02-27
|
|
83
|
+
* DEV-12288 - Bug: wrong error message when upload fails
|
|
84
|
+
## Version v2.1.1
|
|
85
|
+
2022-05-01
|
|
86
|
+
## Version v2.1.2
|
|
87
|
+
2022-05-08
|
|
88
|
+
* DEV-13815 - Bug: CLI - remove "cnvrg data sync" command
|
|
89
|
+
## Version v2.1.3
|
|
90
|
+
2022-05-16
|
|
91
|
+
* DEV-13981 - Bug: CLI - dataset query clone stuck at 50% then "Killed"
|
data/lib/cnvrg/cli.rb
CHANGED
|
@@ -1008,6 +1008,7 @@ module Cnvrg
|
|
|
1008
1008
|
abs_path = dataset_home + "/" + relative_path_dir
|
|
1009
1009
|
abs_path = dataset_home if flatten
|
|
1010
1010
|
fullpath = abs_path + "/" + file_name
|
|
1011
|
+
fullpath = fullpath.gsub("//", "/")
|
|
1011
1012
|
|
|
1012
1013
|
begin
|
|
1013
1014
|
FileUtils.mkdir_p(abs_path) unless File.exist? (fullpath)
|
|
@@ -1018,14 +1019,14 @@ module Cnvrg
|
|
|
1018
1019
|
begin
|
|
1019
1020
|
unless File.exist?(fullpath)
|
|
1020
1021
|
downloader.safe_operation("#{abs_path}/#{file_name}") do
|
|
1021
|
-
|
|
1022
|
+
download = open(f["url"])
|
|
1023
|
+
IO.copy_stream(download, fullpath)
|
|
1022
1024
|
end
|
|
1023
1025
|
end
|
|
1024
1026
|
rescue => e
|
|
1025
1027
|
log_message("Could not download file: #{f["fullpath"]}", Thor::Shell::Color::RED)
|
|
1026
1028
|
exit(1)
|
|
1027
1029
|
end
|
|
1028
|
-
|
|
1029
1030
|
end
|
|
1030
1031
|
#@executer.set_dataset_status(dataset: dataset.slug, status: "cloned") if @executer.present?
|
|
1031
1032
|
rescue Interrupt
|
|
@@ -2061,6 +2062,8 @@ module Cnvrg
|
|
|
2061
2062
|
method_option :init, :type => :boolean, :aliases => ["--initial"], :desc => "initial sync", :default => false
|
|
2062
2063
|
method_option :message, :type => :string, :aliases => ["--message"], :desc => "create commit with message", :default => nil
|
|
2063
2064
|
def sync_data_new(new_branch, force, verbose, commit, all_files, tags ,parallel, chunk_size, init, message)
|
|
2065
|
+
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"])
|
|
2066
|
+
return
|
|
2064
2067
|
verify_logged_in(true)
|
|
2065
2068
|
log_start(__method__, args, options)
|
|
2066
2069
|
log_message('Syncing dataset', Thor::Shell::Color::BLUE, !options["verbose"])
|
|
@@ -2377,7 +2380,11 @@ module Cnvrg
|
|
|
2377
2380
|
if ignore.nil? or ignore.empty?
|
|
2378
2381
|
ignore = ignore_list
|
|
2379
2382
|
end
|
|
2380
|
-
|
|
2383
|
+
|
|
2384
|
+
if job_type != "Experiment"
|
|
2385
|
+
data_ignore = data_dir_include()
|
|
2386
|
+
end
|
|
2387
|
+
|
|
2381
2388
|
if !data_ignore.nil?
|
|
2382
2389
|
if ignore.nil? or ignore.empty?
|
|
2383
2390
|
ignore = data_ignore
|
|
@@ -3412,9 +3419,6 @@ module Cnvrg
|
|
|
3412
3419
|
end
|
|
3413
3420
|
|
|
3414
3421
|
end_commit = @project.last_local_commit
|
|
3415
|
-
if end_commit.present?
|
|
3416
|
-
@exp.job_log(["Experiment end commit: #{end_commit}"])
|
|
3417
|
-
end
|
|
3418
3422
|
|
|
3419
3423
|
# log_thread.join
|
|
3420
3424
|
stats_thread.join if docker_stats
|
|
@@ -5009,10 +5013,10 @@ module Cnvrg
|
|
|
5009
5013
|
else
|
|
5010
5014
|
log_message("#{exp_name} is running should get logs", Thor::Shell::Color::BLUE)
|
|
5011
5015
|
success, num_of_new_files = Cnvrg::Helpers.get_experiment_events_log_via_kubectl(exp, namespace)
|
|
5012
|
-
if !success and exp["last_successful_commit"].present? and !copied_commits.include?(exp["last_successful_commit"])
|
|
5016
|
+
if !success and exp["last_successful_commit"].present? and !copied_commits.include?(exp["last_successful_commit"]["sha1"])
|
|
5013
5017
|
log_message("Failed to get kube files, using last commit", Thor::Shell::Color::BLUE)
|
|
5014
|
-
num_of_new_files = Cnvrg::Helpers.get_experiment_events_log_from_server(exp, @project, commit: exp["last_successful_commit"])
|
|
5015
|
-
copied_commits << exp["last_successful_commit"]
|
|
5018
|
+
num_of_new_files = Cnvrg::Helpers.get_experiment_events_log_from_server(exp, @project, commit: exp["last_successful_commit"]["sha1"])
|
|
5019
|
+
copied_commits << exp["last_successful_commit"]["sha1"]
|
|
5016
5020
|
end
|
|
5017
5021
|
end
|
|
5018
5022
|
|
data/lib/cnvrg/data.rb
CHANGED
|
@@ -101,7 +101,7 @@ module Cnvrg
|
|
|
101
101
|
message = options["message"]
|
|
102
102
|
cli.upload_data_new(new_branch, verbose, sync, force, tags, chunk_size, message:message)
|
|
103
103
|
end
|
|
104
|
-
desc 'data sync', 'Synchronise local dataset directory with remote server'
|
|
104
|
+
desc 'data sync', 'Synchronise local dataset directory with remote server', :hide => true
|
|
105
105
|
method_option :new_branch, :type => :boolean, :aliases => ["-nb"], :desc => "create new branch of commits"
|
|
106
106
|
method_option :force, :type => :boolean, :aliases => ["-f","--force"], :default => false
|
|
107
107
|
method_option :verbose, :type => :boolean, :aliases => ["-v"], :default => false
|
data/lib/cnvrg/datafiles.rb
CHANGED
|
@@ -8,7 +8,7 @@ require 'fileutils'
|
|
|
8
8
|
module Cnvrg
|
|
9
9
|
class Datafiles
|
|
10
10
|
ParallelThreads ||= Cnvrg::Helpers.parallel_threads
|
|
11
|
-
|
|
11
|
+
DIRECTORY_REGEX = /^[a-zA-Z0-9_\/-]+$/
|
|
12
12
|
LARGE_FILE=1024*1024*5
|
|
13
13
|
MULTIPART_SPLIT=10000000
|
|
14
14
|
RETRIES = ENV['UPLOAD_FILE_RETRIES'].try(:to_i) || 10
|
|
@@ -56,9 +56,19 @@ module Cnvrg
|
|
|
56
56
|
end
|
|
57
57
|
raise SignalException.new(1, "Cant find file #{file}") unless File.exists? "#{Dir.pwd}/#{file}"
|
|
58
58
|
end
|
|
59
|
+
is_valid_directory?(paths)
|
|
59
60
|
paths
|
|
60
61
|
end
|
|
61
62
|
|
|
63
|
+
def is_valid_directory?(paths)
|
|
64
|
+
paths.each do |path|
|
|
65
|
+
path = path.gsub('./', '')
|
|
66
|
+
if !path.match(DIRECTORY_REGEX) and File.directory? path
|
|
67
|
+
raise SignalException.new(1, "#{path} is invalid directory name, should contain letters, numbers, '_' , '-'")
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
62
72
|
def get_files_and_folders(paths)
|
|
63
73
|
files_and_folders = {}
|
|
64
74
|
paths.each do |file|
|
|
@@ -1383,13 +1393,13 @@ module Cnvrg
|
|
|
1383
1393
|
in_threads: threads,
|
|
1384
1394
|
isolation: true
|
|
1385
1395
|
}
|
|
1396
|
+
|
|
1386
1397
|
Parallel.map(files["keys"], parallel_options) do |f|
|
|
1387
1398
|
begin
|
|
1388
1399
|
file_path = f['name']
|
|
1389
1400
|
file_path = File.basename(f['name']) if flatten
|
|
1390
1401
|
local_path = @dataset.local_path + '/' + file_path
|
|
1391
1402
|
Cnvrg::Logger.log_info("Downloading #{local_path}")
|
|
1392
|
-
progressbar.progress += 1 if progressbar.present?
|
|
1393
1403
|
if local_path.end_with? "/"
|
|
1394
1404
|
@downloader.mkdir(local_path, recursive: true)
|
|
1395
1405
|
next
|
|
@@ -1410,6 +1420,7 @@ module Cnvrg
|
|
|
1410
1420
|
end
|
|
1411
1421
|
|
|
1412
1422
|
resp = @downloader.safe_download(storage_path, local_path)
|
|
1423
|
+
progressbar.progress += 1 if progressbar.present?
|
|
1413
1424
|
Cnvrg::Logger.log_info("Download #{local_path} success resp: #{resp}")
|
|
1414
1425
|
rescue => e
|
|
1415
1426
|
Cnvrg::Logger.log_error(e)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
require 'open-uri'
|
|
1
2
|
require 'azure/storage/blob'
|
|
3
|
+
require 'azure/storage/common/core'
|
|
2
4
|
|
|
3
5
|
module Cnvrg
|
|
4
6
|
module Downloader
|
|
@@ -13,10 +15,27 @@ module Cnvrg
|
|
|
13
15
|
|
|
14
16
|
def download(storage_path, local_path, decrypt: true)
|
|
15
17
|
prepare_download(local_path)
|
|
18
|
+
|
|
16
19
|
storage_path = Cnvrg::Helpers.decrypt(@key, @iv, storage_path) if decrypt
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
# We generate a temp uri in order to stream the file instead of using "get_blob" that overflows memory
|
|
22
|
+
uri = client.send(:blob_uri, @container, storage_path)
|
|
23
|
+
|
|
24
|
+
generator = Azure::Storage::Common::Core::Auth::SharedAccessSignature.new(@account_name, @access_key)
|
|
25
|
+
|
|
26
|
+
expiring_url = generator.signed_uri(
|
|
27
|
+
uri,
|
|
28
|
+
false,
|
|
29
|
+
service: 'b',
|
|
30
|
+
resource: 'b',
|
|
31
|
+
permissions: 'r',
|
|
32
|
+
start: (Time.now - (5 * 60)).utc.iso8601, # start 5 minutes ago
|
|
33
|
+
expiry: (Time.now + 60 * 60 * 2).utc.iso8601 # expire in 2 hours
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
# Stream the file without loading it all into memory
|
|
37
|
+
download = open(expiring_url)
|
|
38
|
+
IO.copy_stream(download, local_path)
|
|
20
39
|
end
|
|
21
40
|
|
|
22
41
|
def upload(storage_path, local_path)
|
data/lib/cnvrg/files.rb
CHANGED
|
@@ -106,7 +106,7 @@ module Cnvrg
|
|
|
106
106
|
commit: commit_sha1
|
|
107
107
|
})
|
|
108
108
|
unless Cnvrg::CLI.is_response_success(resp, false)
|
|
109
|
-
raise StandardError.new("
|
|
109
|
+
raise StandardError.new("Cant upload files to the server")
|
|
110
110
|
end
|
|
111
111
|
# resolve bucket
|
|
112
112
|
res = resp['result']
|
data/lib/cnvrg/helpers/agent.rb
CHANGED
|
@@ -89,7 +89,7 @@ class Cnvrg::Helpers::Executer
|
|
|
89
89
|
while agent_id.blank? or main_id.blank?
|
|
90
90
|
grep_by = @job_id
|
|
91
91
|
grep_by = "$(hostname)" if ENV['KUBERNETES_PORT'].present?
|
|
92
|
-
cntrs = `docker ps --format "table {{.ID}},{{.Names}}" | grep -i #{grep_by}`.split("\n").map{|x| x.strip}
|
|
92
|
+
cntrs = `docker ps --format "table {{.ID}},{{.Names}}" 2> /dev/null | grep -i #{grep_by}`.split("\n").map{|x| x.strip}
|
|
93
93
|
agent_id = cntrs.find{|container_name| container_name.include? "agent"}.split(",").first rescue nil
|
|
94
94
|
main_id = cntrs.find{|container_name| container_name.include? @main_name}.split(",").first rescue nil
|
|
95
95
|
sleep(2)
|
|
@@ -168,6 +168,9 @@ class Cnvrg::Helpers::Executer
|
|
|
168
168
|
while !success and retries < 100
|
|
169
169
|
begin
|
|
170
170
|
resp = Cnvrg::API.request(activity_url, "PUT", {stats: executer_stats})
|
|
171
|
+
if !resp
|
|
172
|
+
raise StandardError.new("Failed to send request to server")
|
|
173
|
+
end
|
|
171
174
|
machine_activity = resp["machine_activity"]
|
|
172
175
|
success = true
|
|
173
176
|
puts("Connected to server")
|
|
@@ -216,6 +219,7 @@ class Cnvrg::Helpers::Executer
|
|
|
216
219
|
def wait_for_main
|
|
217
220
|
copy_file_to_main
|
|
218
221
|
start_tiny_if_missing
|
|
222
|
+
retries = 0
|
|
219
223
|
puts("Waiting for main container")
|
|
220
224
|
STDOUT.flush
|
|
221
225
|
got_response = false
|
|
@@ -233,9 +237,12 @@ class Cnvrg::Helpers::Executer
|
|
|
233
237
|
got_response = true
|
|
234
238
|
end
|
|
235
239
|
rescue => e
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
240
|
+
retries += 1
|
|
241
|
+
if retries > 3
|
|
242
|
+
puts("Failed to connect to main")
|
|
243
|
+
puts(e.message)
|
|
244
|
+
STDOUT.flush
|
|
245
|
+
end
|
|
239
246
|
sleep(0.1)
|
|
240
247
|
next
|
|
241
248
|
end
|
|
@@ -265,13 +272,30 @@ class Cnvrg::Helpers::Executer
|
|
|
265
272
|
end
|
|
266
273
|
|
|
267
274
|
def execute_cmds
|
|
268
|
-
|
|
275
|
+
pids_by_slug = {}
|
|
269
276
|
while true
|
|
270
277
|
if @commands_q.empty?
|
|
271
278
|
sleep(5)
|
|
272
279
|
next
|
|
273
280
|
end
|
|
274
281
|
cmd = @commands_q.pop.symbolize_keys
|
|
282
|
+
|
|
283
|
+
if cmd[:wait_slug].present?
|
|
284
|
+
if pids_by_slug[cmd[:wait_slug]].present?
|
|
285
|
+
other_pid = pids_by_slug[cmd[:wait_slug]]
|
|
286
|
+
begin
|
|
287
|
+
Process.waitpid(other_pid, Process::WNOHANG)
|
|
288
|
+
running = true
|
|
289
|
+
rescue Errno::ECHILD => e
|
|
290
|
+
running = false
|
|
291
|
+
end
|
|
292
|
+
if running
|
|
293
|
+
@commands_q.push(cmd)
|
|
294
|
+
sleep(5)
|
|
295
|
+
next
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
end
|
|
275
299
|
command_json = Cnvrg::API.request([activity_url, "commands", cmd[:slug]].join('/'), "GET")
|
|
276
300
|
|
|
277
301
|
cmd_status = command_json["status"] rescue ""
|
|
@@ -288,10 +312,9 @@ class Cnvrg::Helpers::Executer
|
|
|
288
312
|
else
|
|
289
313
|
Process.detach(pid)
|
|
290
314
|
end
|
|
291
|
-
|
|
315
|
+
pids_by_slug[cmd[:slug]] = pid
|
|
292
316
|
######
|
|
293
317
|
end
|
|
294
|
-
pids
|
|
295
318
|
end
|
|
296
319
|
|
|
297
320
|
def merge_log_block(logs)
|
|
@@ -303,7 +326,7 @@ class Cnvrg::Helpers::Executer
|
|
|
303
326
|
pod_name = `hostname`.strip rescue nil
|
|
304
327
|
node_name = nil
|
|
305
328
|
if pod_name.present?
|
|
306
|
-
pod_describe = `kubectl get pod #{pod_name} -o json` rescue nil
|
|
329
|
+
pod_describe = `kubectl get pod #{pod_name} -o json 2> /dev/null` rescue nil
|
|
307
330
|
pod_describe = JSON.parse(pod_describe) rescue {}
|
|
308
331
|
node_name = pod_describe["spec"]["nodeName"] rescue nil
|
|
309
332
|
end
|
|
@@ -366,4 +389,4 @@ class Cnvrg::Helpers::Executer
|
|
|
366
389
|
conn.options.open_timeout = open_timeout
|
|
367
390
|
conn
|
|
368
391
|
end
|
|
369
|
-
end
|
|
392
|
+
end
|
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: 2.
|
|
4
|
+
version: 2.1.3
|
|
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-
|
|
13
|
+
date: 2022-05-16 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: bundler
|