cnvrg 1.9.8 → 1.9.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cnvrg/cli.rb +5 -5
- data/lib/cnvrg/cli/library_cli.rb +1 -1
- data/lib/cnvrg/data.rb +5 -1
- data/lib/cnvrg/datafiles.rb +31 -45
- data/lib/cnvrg/dataset.rb +1 -1
- data/lib/cnvrg/helpers/executer.rb +2 -2
- data/lib/cnvrg/job_cli.rb +6 -7
- data/lib/cnvrg/job_ssh.rb +2 -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: 8d2e4f14c9dfbb2875eebd2de45262eff3e4a2bc848e7d0305610092c84faa46
|
4
|
+
data.tar.gz: 6ba88a0190689ba218441f1f6c6d9307b71cf5a889a3649692aa556656e533ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd22dd71906534018350166af1f23d20b8aa085dfb88b09d750974dd0f0229337a36efcdd34455ad9e0435846e7f4333bd5c4a5e3cf353ad8ca926ee011a8993
|
7
|
+
data.tar.gz: a4cae273a0000073d3955f60c0ebc5dd88c5b4ac1f28d5c09b1e99bbffe284446d8bee93bd97d33f2ba58052222d51c69c28a2c4bc31322205cf779e4adf7f2f
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -1191,7 +1191,7 @@ module Cnvrg
|
|
1191
1191
|
end
|
1192
1192
|
|
1193
1193
|
desc '', '', :hide => true
|
1194
|
-
def data_put(dataset_url, files: [], dir: '', commit: '', chunk_size: 1000, force: false, threads: 15, message: nil)
|
1194
|
+
def data_put(dataset_url, files: [], dir: '', commit: '', chunk_size: 1000, force: false, override: false, threads: 15, message: nil)
|
1195
1195
|
begin
|
1196
1196
|
verify_logged_in(false)
|
1197
1197
|
log_start(__method__, args, options)
|
@@ -1207,7 +1207,7 @@ module Cnvrg
|
|
1207
1207
|
log_message("Uploading #{@files.size} files", Thor::Shell::Color::GREEN)
|
1208
1208
|
number_of_chunks = (@files.size.to_f / chunk_size).ceil
|
1209
1209
|
if commit.blank?
|
1210
|
-
response = @datafiles.start_commit(false,
|
1210
|
+
response = @datafiles.start_commit(false, force, chunks: number_of_chunks, message: message )
|
1211
1211
|
unless response #means we failed in the start commit.
|
1212
1212
|
raise SignalException.new(1, "Cant put files into dataset, check the dataset id")
|
1213
1213
|
end
|
@@ -1229,7 +1229,7 @@ module Cnvrg
|
|
1229
1229
|
@datafiles.upload_multiple_files_optimized(
|
1230
1230
|
@files,
|
1231
1231
|
@commit,
|
1232
|
-
|
1232
|
+
override: override,
|
1233
1233
|
chunk_size: chunk_size,
|
1234
1234
|
prefix: dir,
|
1235
1235
|
threads: threads
|
@@ -1241,7 +1241,7 @@ module Cnvrg
|
|
1241
1241
|
raise SignalException.new(1, res.msg)
|
1242
1242
|
end
|
1243
1243
|
|
1244
|
-
res = @datafiles.end_commit(@commit,
|
1244
|
+
res = @datafiles.end_commit(@commit,force, success: true, commit_type: "put")
|
1245
1245
|
msg = res['result']
|
1246
1246
|
response = Cnvrg::Result.new(Cnvrg::CLI.is_response_success(res, true), msg)
|
1247
1247
|
unless response.is_success?
|
@@ -4584,7 +4584,7 @@ module Cnvrg
|
|
4584
4584
|
|
4585
4585
|
end
|
4586
4586
|
|
4587
|
-
desc 'file_exists',
|
4587
|
+
desc 'file_exists', '', :hide => true
|
4588
4588
|
def file_exists(file)
|
4589
4589
|
exit(0) if File.exists? file
|
4590
4590
|
exit(1)
|
data/lib/cnvrg/data.rb
CHANGED
@@ -213,13 +213,16 @@ module Cnvrg
|
|
213
213
|
method_option :dir, :type => :string, :aliases => ["-d", "--dir"], :default => ''
|
214
214
|
method_option :commit, :type => :string, :aliases => ["-c", "--commit"], :default => ''
|
215
215
|
method_option :force, :type => :boolean, :aliases => ["-f","--force"], :default => false
|
216
|
+
method_option :override, :type => :boolean, :aliases => ["--override"], :default => false
|
216
217
|
method_option :threads, :type => :numeric, :aliases => ["-t","--threads"], :default => 15
|
217
218
|
method_option :chunk_size, :type => :numeric, :aliases => ["-cs","--chunk"], :default => 1000
|
218
219
|
method_option :message, :type => :string, :aliases => ["--message"], :desc => "create commit with message", :default => nil
|
220
|
+
|
219
221
|
def put(dataset_url, *files)
|
220
222
|
cli = Cnvrg::CLI.new()
|
221
223
|
dir = options[:dir]
|
222
|
-
force = options[
|
224
|
+
force = options[:force]
|
225
|
+
override = options[:override]
|
223
226
|
commit = options[:commit]
|
224
227
|
message = options[:message]
|
225
228
|
threads = options[:threads]
|
@@ -230,6 +233,7 @@ module Cnvrg
|
|
230
233
|
dir: dir,
|
231
234
|
commit: commit,
|
232
235
|
force: force,
|
236
|
+
override: override,
|
233
237
|
threads: threads,
|
234
238
|
chunk_size: chunk_size,
|
235
239
|
message: message
|
data/lib/cnvrg/datafiles.rb
CHANGED
@@ -302,13 +302,13 @@ module Cnvrg
|
|
302
302
|
end
|
303
303
|
end
|
304
304
|
|
305
|
-
def request_upload_files(commit_sha1, tree,
|
305
|
+
def request_upload_files(commit_sha1, tree, override, new_branch, partial_commit)
|
306
306
|
retry_count = 0
|
307
307
|
loop do
|
308
308
|
upload_resp = Cnvrg::API.request(@base_resource + "upload_files", 'POST_JSON', {
|
309
309
|
commit_sha1: commit_sha1,
|
310
310
|
tree: tree,
|
311
|
-
|
311
|
+
override: override,
|
312
312
|
is_branch: new_branch,
|
313
313
|
partial_commit: partial_commit
|
314
314
|
})
|
@@ -330,7 +330,7 @@ module Cnvrg
|
|
330
330
|
|
331
331
|
end
|
332
332
|
|
333
|
-
def upload_multiple_files_optimized(files, commit_sha1, threads:
|
333
|
+
def upload_multiple_files_optimized(files, commit_sha1, threads: 15, chunk_size: 1000, override: false, new_branch: false, prefix: '', partial_commit: nil)
|
334
334
|
cli = CLI.new
|
335
335
|
cli.log_message("Using #{threads} threads with chunk size of #{chunk_size}.", Thor::Shell::Color::GREEN)
|
336
336
|
|
@@ -406,8 +406,8 @@ module Cnvrg
|
|
406
406
|
# Fetch the required files from the server:
|
407
407
|
Parallel.map((file_chunks), in_threads: 10) do |files_chunk|
|
408
408
|
|
409
|
-
tree = @dataset.generate_chunked_idx(files_chunk, prefix: prefix)
|
410
|
-
results = request_upload_files(commit_sha1, tree,
|
409
|
+
tree = @dataset.generate_chunked_idx(files_chunk, prefix: prefix, threads: threads)
|
410
|
+
results = request_upload_files(commit_sha1, tree, override, new_branch, partial_commit)
|
411
411
|
|
412
412
|
# puts "Got #{results['files'].size} files to upload from #{files_chunk.size} files"
|
413
413
|
|
@@ -1149,43 +1149,29 @@ module Cnvrg
|
|
1149
1149
|
end
|
1150
1150
|
|
1151
1151
|
def start_commit(new_branch, force=false, chunks: 0, dataset: @dataset, message:nil)
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
)
|
1152
|
+
#if we are pushing with force or to branch we dont need to send current/next commit cause we want to
|
1153
|
+
# create a new commit.
|
1154
|
+
idx = {}
|
1155
|
+
commit = idx[:commit]
|
1156
|
+
next_commit = idx[:next_commit]
|
1157
|
+
response = Cnvrg::API.request(
|
1158
|
+
"#{base_resource}/commit/start",
|
1159
|
+
'POST',
|
1160
|
+
{
|
1161
|
+
dataset_slug: @dataset_slug,
|
1162
|
+
new_branch: new_branch,
|
1163
|
+
force:force,
|
1164
|
+
username: @owner,
|
1165
|
+
current_commit: commit,
|
1166
|
+
next_commit: next_commit,
|
1167
|
+
total_chunks: chunks,
|
1168
|
+
message: message
|
1169
|
+
}
|
1170
|
+
)
|
1172
1171
|
Cnvrg::CLI.is_response_success(response, true)
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
end
|
1177
|
-
end
|
1178
|
-
|
1179
|
-
def last_valid_commit()
|
1180
|
-
begin
|
1181
|
-
#if we are pushing with force or to branch we dont need to send current/next commit cause we want to
|
1182
|
-
# create a new commit.
|
1183
|
-
response = Cnvrg::API.request("#{base_resource}/last_valid_commit", 'GET')
|
1184
|
-
Cnvrg::CLI.is_response_success(response, true)
|
1185
|
-
return response
|
1186
|
-
rescue => e
|
1187
|
-
return false
|
1188
|
-
end
|
1172
|
+
response
|
1173
|
+
rescue => e
|
1174
|
+
false
|
1189
1175
|
end
|
1190
1176
|
|
1191
1177
|
def end_commit(commit_sha1, force, success: true, uploaded_files: 0, commit_type: nil)
|
@@ -1319,10 +1305,10 @@ module Cnvrg
|
|
1319
1305
|
# blob
|
1320
1306
|
local_path = "#{local_path}.conflict" if conflict
|
1321
1307
|
storage_path = f["path"]
|
1322
|
-
if File.exists? local_path
|
1323
|
-
|
1324
|
-
|
1325
|
-
end
|
1308
|
+
# if File.exists? local_path
|
1309
|
+
# Cnvrg::Logger.log_info("Trying to download #{local_path} but its already exists, skipping..")
|
1310
|
+
# next
|
1311
|
+
# end
|
1326
1312
|
resp = @downloader.download(storage_path, local_path)
|
1327
1313
|
Cnvrg::Logger.log_info("Download #{local_path} success resp: #{resp}")
|
1328
1314
|
rescue => e
|
data/lib/cnvrg/dataset.rb
CHANGED
@@ -541,7 +541,7 @@ module Cnvrg
|
|
541
541
|
"#{url}/#{self.owner}/datasets/#{self.slug}"
|
542
542
|
end
|
543
543
|
|
544
|
-
def generate_chunked_idx(list_files = [], threads:
|
544
|
+
def generate_chunked_idx(list_files = [], threads: 15, prefix: '')
|
545
545
|
tree = {}
|
546
546
|
Parallel.map(list_files, in_threads: threads) do |file|
|
547
547
|
#check if prefix exists do prefix/path otherwise path
|
@@ -89,7 +89,7 @@ class Cnvrg::Helpers::Executer
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def current_homedir
|
92
|
-
`env | grep HOME`.strip.split("=").try(:last)
|
92
|
+
`env | grep -w HOME`.strip.split("=").try(:last)
|
93
93
|
end
|
94
94
|
|
95
95
|
def spark_path
|
@@ -97,7 +97,7 @@ class Cnvrg::Helpers::Executer
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def slave_homedir()
|
100
|
-
run_in_slave("env | grep HOME").split("=").try(:last)
|
100
|
+
run_in_slave("env | grep -w HOME").split("=").try(:last)
|
101
101
|
end
|
102
102
|
|
103
103
|
def slave_env
|
data/lib/cnvrg/job_cli.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Cnvrg
|
2
2
|
class JobCli < SubCommandBase
|
3
3
|
|
4
|
-
desc 'log',
|
4
|
+
desc 'log', '', :hide => true
|
5
5
|
method_option :level, :type => :string, :aliases => ["-l", "--level"], :default => 'info'
|
6
6
|
method_option :step, :type => :string, :aliases => ["-s", "--step"], :default => nil
|
7
7
|
method_option :restart, :type => :boolean, :aliases => ["-r", "--restart"], :default => false
|
@@ -15,7 +15,7 @@ module Cnvrg
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
desc 'requirements',
|
18
|
+
desc 'requirements', '', :hide => true
|
19
19
|
def requirements
|
20
20
|
cli = Cnvrg::CLI.new
|
21
21
|
cli.log_start(__method__, args, options)
|
@@ -23,7 +23,7 @@ module Cnvrg
|
|
23
23
|
@project = Project.new(project_dir, owner: ENV['CNVRG_OWNER'], slug: ENV['CNVRG_PROJECT'])
|
24
24
|
end
|
25
25
|
|
26
|
-
desc 'install_reqs',
|
26
|
+
desc 'install_reqs', 'Install requirements', :hide => true
|
27
27
|
def install_reqs
|
28
28
|
cli = Cnvrg::CLI.new
|
29
29
|
cli.log_start(__method__, args, options)
|
@@ -33,8 +33,7 @@ module Cnvrg
|
|
33
33
|
@executer.execute_cmds(commands)
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
desc 'start', description: "Job Start!", hide: true
|
36
|
+
desc 'start', 'Job Start!', :hide => true
|
38
37
|
def start
|
39
38
|
cli = Cnvrg::CLI.new
|
40
39
|
cli.log_start(__method__, args, options)
|
@@ -47,7 +46,7 @@ module Cnvrg
|
|
47
46
|
@executer.main_thread
|
48
47
|
end
|
49
48
|
|
50
|
-
desc 'stats',
|
49
|
+
desc 'stats', 'stats of agent and slave', :hide => true
|
51
50
|
def stats
|
52
51
|
cli = Cnvrg::CLI.new
|
53
52
|
cli.log_start(__method__, args, options)
|
@@ -59,7 +58,7 @@ module Cnvrg
|
|
59
58
|
@executer.executer_stats
|
60
59
|
end
|
61
60
|
|
62
|
-
desc 'pre_pod_stop',
|
61
|
+
desc 'pre_pod_stop', '', :hide => true
|
63
62
|
def pre_pod_stop
|
64
63
|
cli = Cnvrg::CLI.new
|
65
64
|
cli.log_start(__method__, args, options)
|
data/lib/cnvrg/job_ssh.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Cnvrg
|
2
2
|
class JobSsh < SubCommandBase
|
3
|
-
|
3
|
+
|
4
|
+
desc 'ssh start', 'stats of agent and slave'
|
4
5
|
method_option :port, :type => :numeric, :aliases => ["-p", "--port"], :desc => "Port to bind into", :default => 2222
|
5
6
|
method_option :username, :type => :string, :aliases => ["-u", "--username"], :desc => "Job container user name", :default => nil
|
6
7
|
method_option :password, :type => :string, :aliases => ["--password"], :desc =>"Job Conatainer user name, will be set by cnvrg", :default => nil
|
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.9.
|
4
|
+
version: 1.9.9.5
|
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-07-
|
13
|
+
date: 2020-07-19 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.4
|
457
457
|
signing_key:
|
458
458
|
specification_version: 4
|
459
459
|
summary: A CLI tool for interacting with cnvrg.io.
|