cnvrg 0.0.1421 → 0.0.1422
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/lib/cnvrg/cli.rb +44 -42
- data/lib/cnvrg/files.rb +2 -2
- data/lib/cnvrg/project.rb +8 -0
- data/lib/cnvrg/version.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d00f4715dff9ff27fc5dce8cd6de74e5dc846302
|
4
|
+
data.tar.gz: c3c218341d0d7ecba3f0b7bf0fcd09660bbeadec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c01d5eb58da2edfedcce2bf7cc6754384aa133fa335e94edc9888688f9fcf20bb5ffc1879495b37661a9a1650cbfdb6ab56813270089e6cd11856ad28ffc2fc
|
7
|
+
data.tar.gz: 2d2554208488d719ae4041a4c5e6dee3eaa588ded0794f06b446482f6e5c5a95d2a0e2013f1fe6e14f79c0c4e1d0a63587d24614f9acc018473afa2778475f18
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -122,7 +122,7 @@ class Thor
|
|
122
122
|
def is_option (options, p)
|
123
123
|
options.each do |o|
|
124
124
|
if !o.aliases.nil?
|
125
|
-
if (o.aliases.is_a? Array and o.aliases.include? p) or (
|
125
|
+
if (o.aliases.is_a? Array and o.aliases.include? p) or (o.aliases.is_a? Array and o.aliases.size ==1 and o.aliases[0].split(",").include? p) or o.switch_name.eql? p
|
126
126
|
return o
|
127
127
|
end
|
128
128
|
end
|
@@ -1330,20 +1330,20 @@ module Cnvrg
|
|
1330
1330
|
|
1331
1331
|
end
|
1332
1332
|
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1333
|
+
desc 'commits', 'List all commits for a specific dataset'
|
1334
|
+
|
1335
|
+
def list_commits()
|
1336
|
+
verify_logged_in(true)
|
1337
|
+
log_start(__method__, args, options)
|
1338
|
+
|
1339
|
+
project_dir = is_cnvrg_dir(Dir.pwd)
|
1340
|
+
@project = Project.new(project_dir)
|
1341
|
+
result = @project.list_commits()
|
1342
|
+
list = result["result"]["list"]
|
1343
|
+
|
1344
|
+
print_table(list)
|
1345
|
+
|
1346
|
+
end
|
1347
1347
|
|
1348
1348
|
|
1349
1349
|
desc 'unlink', 'Unlink a project from current directory'
|
@@ -1404,6 +1404,7 @@ module Cnvrg
|
|
1404
1404
|
Cnvrg::CLI.is_response_success response
|
1405
1405
|
working_dir = project_home
|
1406
1406
|
docker_image = response["result"]["image"]
|
1407
|
+
current_commit = response["result"]["commit"]
|
1407
1408
|
idx = {commit: response["result"]["commit"], tree: response["result"]["tree"]}
|
1408
1409
|
File.open(working_dir + "/.cnvrg/idx.yml", "w+") { |f| f.write idx.to_yaml }
|
1409
1410
|
if !docker_image.nil? and !docker_image.empty? and !remote
|
@@ -1445,7 +1446,8 @@ module Cnvrg
|
|
1445
1446
|
end
|
1446
1447
|
else
|
1447
1448
|
# blob
|
1448
|
-
|
1449
|
+
|
1450
|
+
if @files.download_file_s3(f[0], relative_path, project_home,commit_sha1=current_commit)
|
1449
1451
|
successful_changes << relative_path
|
1450
1452
|
end
|
1451
1453
|
end
|
@@ -1844,7 +1846,7 @@ module Cnvrg
|
|
1844
1846
|
|
1845
1847
|
result["conflicts"].each do |f|
|
1846
1848
|
relative_path = f.gsub(/^#{@project.local_path}/, "")
|
1847
|
-
if @files.download_file_s3(f, relative_path, project_home, conflict=true)
|
1849
|
+
if @files.download_file_s3(f, relative_path, project_home,commit_sha1=nil, conflict=true)
|
1848
1850
|
successful_changes << relative_path
|
1849
1851
|
end
|
1850
1852
|
|
@@ -1969,7 +1971,7 @@ module Cnvrg
|
|
1969
1971
|
end
|
1970
1972
|
else
|
1971
1973
|
# blob
|
1972
|
-
if @files.download_file_s3(f[0], relative_path, project_home)
|
1974
|
+
if @files.download_file_s3(f[0], relative_path, project_home,commit_sha1=commit_sha1)
|
1973
1975
|
current_tree.delete(relative_path)
|
1974
1976
|
|
1975
1977
|
successful_changes << relative_path
|
@@ -2061,26 +2063,26 @@ module Cnvrg
|
|
2061
2063
|
|
2062
2064
|
|
2063
2065
|
desc 'run cmd', 'Runs an experiment'
|
2064
|
-
method_option :local, :type => :boolean, :aliases => ["-l"], :default => false
|
2066
|
+
method_option :local, :type => :boolean, :aliases => ["-l","--local"], :default => false
|
2065
2067
|
method_option :small, :type => :boolean, :aliases => ["-sm", "--small"], :default => false
|
2066
2068
|
method_option :medium, :type => :boolean, :aliases => ["-md", "--medium"], :default => false
|
2067
2069
|
method_option :large, :type => :boolean, :aliases => ["-lg", "--large"], :default => false
|
2068
2070
|
method_option :gpu, :type => :boolean, :aliases => ["--gpu"], :default => false
|
2069
2071
|
method_option :gpuxl, :type => :boolean, :aliases => ["--gpuxl"], :default => false
|
2070
2072
|
method_option :gpuxxl, :type => :boolean, :aliases => ["--gpuxxl"], :default => false
|
2071
|
-
method_option :sync_before, :type => :boolean, :aliases => ["-sb"], :default => true
|
2072
|
-
method_option :sync_after, :type => :boolean, :aliases => ["-sa"], :default => true
|
2073
|
+
method_option :sync_before, :type => :boolean, :aliases => ["-sb","--sync_before"], :default => true
|
2074
|
+
method_option :sync_after, :type => :boolean, :aliases => ["-sa","--sync_after"], :default => true
|
2073
2075
|
method_option :title, :type => :string, :aliases => ["-t", "--title"], :default => ""
|
2074
2076
|
method_option :log, :type => :boolean, :aliases => ["--log"], :default => false
|
2075
|
-
method_option :email_notification, :type => :boolean, :aliases => ["-en"], :default => false
|
2076
|
-
method_option :upload_output, :type => :string, :aliases => ["-uo"], :default => ""
|
2077
|
-
method_option :commit, :type => :string, :aliases => ["-c"], :default => ""
|
2078
|
-
method_option :schedule, :type => :string, :aliases => ["-s"], :default => ""
|
2079
|
-
method_option :image, :type => :string, :aliases => ["-i"], :default => ""
|
2077
|
+
method_option :email_notification, :type => :boolean, :aliases => ["-en","--email_notification"], :default => false
|
2078
|
+
method_option :upload_output, :type => :string, :aliases => ["-uo","--upload_output"], :default => ""
|
2079
|
+
method_option :commit, :type => :string, :aliases => ["-c","--commit"], :default => ""
|
2080
|
+
method_option :schedule, :type => :string, :aliases => ["-s","--schedule"], :default => ""
|
2081
|
+
method_option :image, :type => :string, :aliases => ["-i","--image"], :default => ""
|
2080
2082
|
method_option :grid, :type => :string, :aliases => ["-g", "--grid"], :default => ""
|
2081
2083
|
method_option :data, :type => :string, :aliases => ["-d", "--data"], :default => ""
|
2082
2084
|
method_option :data_commit, :type => :string, :aliases => ["--data_commit"], :default => ""
|
2083
|
-
method_option :ignore, :type => :string, :aliases => ["-i"], :desc => "ignore following files", :default => ""
|
2085
|
+
method_option :ignore, :type => :string, :aliases => ["-i","--ignore"], :desc => "ignore following files", :default => ""
|
2084
2086
|
|
2085
2087
|
def run(*cmd)
|
2086
2088
|
sync_before = options["sync_before"]
|
@@ -2103,7 +2105,7 @@ module Cnvrg
|
|
2103
2105
|
real_options << o if (!o[1].eql? "" and !["small", "medium", "large", "gpu", "gpuxl", "gpuxxl"].include? o[0])
|
2104
2106
|
end
|
2105
2107
|
if local
|
2106
|
-
invoke :exec, cmd, :sync_before => sync_before, :sync_after => sync_after, :title => title,
|
2108
|
+
invoke :exec, [cmd], :sync_before => sync_before, :sync_after => sync_after, :title => title,
|
2107
2109
|
:log => log, :email_notification => email_notification, :upload_output => upload_output,
|
2108
2110
|
:commit => commit, :image => image, :data => data, :data_commit => data_commit, :ignore => ignore
|
2109
2111
|
return
|
@@ -2139,16 +2141,16 @@ module Cnvrg
|
|
2139
2141
|
desc '', '', :hide => true
|
2140
2142
|
method_option :sync_before, :type => :boolean, :aliases => ["-sb,--sync_before"], :default => true
|
2141
2143
|
method_option :sync_after, :type => :boolean, :aliases => ["-sa,--sync_after"], :default => true
|
2142
|
-
method_option :title, :type => :string, :aliases => ["-t"], :default => ""
|
2143
|
-
method_option :log, :type => :boolean, :aliases => [
|
2144
|
+
method_option :title, :type => :string, :aliases => ["-t","--title"], :default => ""
|
2145
|
+
method_option :log, :type => :boolean, :aliases => [ "--log"], :default => false
|
2144
2146
|
method_option :email_notification, :type => :boolean, :aliases => ["-en,--email_notification"], :default => false
|
2145
2147
|
method_option :upload_output, :type => :string, :aliases => ["-uo,--upload_output"], :default => ""
|
2146
|
-
method_option :commit, :type => :string, :aliases => ["-c"], :default => ""
|
2147
|
-
method_option :image, :type => :string, :aliases => ["-i"], :default => ""
|
2148
|
+
method_option :commit, :type => :string, :aliases => ["-c","--commit"], :default => ""
|
2149
|
+
method_option :image, :type => :string, :aliases => ["-i","--image"], :default => ""
|
2148
2150
|
method_option :indocker, :type => :boolean, :aliases => ["--indocker"], :default => false
|
2149
2151
|
method_option :data, :type => :string, :aliases => ["-d", "--data"], :default => ""
|
2150
2152
|
method_option :data_commit, :type => :string, :aliases => ["-dc", "--data_commit"], :default => ""
|
2151
|
-
method_option :ignore, :type => :string, :aliases => ["-i"], :desc => "ignore following files", :default => ""
|
2153
|
+
method_option :ignore, :type => :string, :aliases => ["-i","--ignore"], :desc => "ignore following files", :default => ""
|
2152
2154
|
|
2153
2155
|
|
2154
2156
|
def exec(*cmd)
|
@@ -2562,20 +2564,20 @@ module Cnvrg
|
|
2562
2564
|
end
|
2563
2565
|
|
2564
2566
|
desc '', '', :hide => true
|
2565
|
-
method_option :sync_before, :type => :boolean, :aliases => ["-sb"], :default => true
|
2566
|
-
method_option :sync_after, :type => :boolean, :aliases => ["-sa"], :default => true
|
2567
|
-
method_option :title, :type => :string, :aliases => ["-t"], :default => ""
|
2568
|
-
method_option :log, :type => :boolean, :aliases => [
|
2569
|
-
method_option :email_notification, :type => :boolean, :aliases => ["-en"], :default => false
|
2570
|
-
method_option :upload_output, :type => :string, :aliases => ["-uo"], :default => ""
|
2567
|
+
method_option :sync_before, :type => :boolean, :aliases => ["-sb","--sync_before"], :default => true
|
2568
|
+
method_option :sync_after, :type => :boolean, :aliases => ["-sa","--sync_after"], :default => true
|
2569
|
+
method_option :title, :type => :string, :aliases => ["-t","--title"], :default => ""
|
2570
|
+
method_option :log, :type => :boolean, :aliases => [ "--log"], :default => false
|
2571
|
+
method_option :email_notification, :type => :boolean, :aliases => ["-en","--email_notification"], :default => false
|
2572
|
+
method_option :upload_output, :type => :string, :aliases => ["-uo","--upload_output"], :default => ""
|
2571
2573
|
method_option :machine_type, :type => :string, :default => ""
|
2572
|
-
method_option :schedule, :type => :string, :aliases => ["-s"], :default => ""
|
2574
|
+
method_option :schedule, :type => :string, :aliases => ["-s","--schedule"], :default => ""
|
2573
2575
|
method_option :commit, :type => :string, :aliases => ["-c, --commit"], :default => nil
|
2574
|
-
method_option :image, :type => :string, :aliases => ["-i"], :default => ""
|
2576
|
+
method_option :image, :type => :string, :aliases => ["-i","--image"], :default => ""
|
2575
2577
|
method_option :grid, :type => :string, :aliases => ["-g", "--grid"], :default => ""
|
2576
2578
|
method_option :data, :type => :string, :aliases => ["-d", "--data"], :default => ""
|
2577
2579
|
method_option :data_commit, :type => :string, :aliases => ["--data_commit"], :default => ""
|
2578
|
-
method_option :ignore, :type => :string, :aliases => ["-i"], :desc => "ignore following files", :default => ""
|
2580
|
+
method_option :ignore, :type => :string, :aliases => ["-i","--ignore"], :desc => "ignore following files", :default => ""
|
2579
2581
|
|
2580
2582
|
def exec_remote(*cmd)
|
2581
2583
|
verify_logged_in(true)
|
data/lib/cnvrg/files.rb
CHANGED
@@ -333,9 +333,9 @@ module Cnvrg
|
|
333
333
|
response = Cnvrg::API.request(@base_resource + "create_dir", 'POST', {absolute_path: absolute_path, relative_path: relative_path, commit_sha1: commit_sha1})
|
334
334
|
return Cnvrg::CLI.is_response_success(response, false)
|
335
335
|
end
|
336
|
-
def download_file_s3(absolute_path, relative_path, project_home, conflict=false)
|
336
|
+
def download_file_s3(absolute_path, relative_path, project_home,commit_sha1=nil, conflict=false)
|
337
337
|
begin
|
338
|
-
res = Cnvrg::API.request(@base_resource + "download_file", 'POST', {absolute_path: absolute_path, relative_path: relative_path})
|
338
|
+
res = Cnvrg::API.request(@base_resource + "download_file", 'POST', {absolute_path: absolute_path, relative_path: relative_path,commit_sha1:commit_sha1})
|
339
339
|
Cnvrg::CLI.is_response_success(res, false)
|
340
340
|
if res["result"]
|
341
341
|
download_resp = res
|
data/lib/cnvrg/project.rb
CHANGED
@@ -23,6 +23,9 @@ module Cnvrg
|
|
23
23
|
idx = YAML.load_file(@local_path + "/.cnvrg/idx.yml")
|
24
24
|
return idx[:commit]
|
25
25
|
end
|
26
|
+
def get_last_commit
|
27
|
+
|
28
|
+
end
|
26
29
|
|
27
30
|
def url
|
28
31
|
url = Cnvrg::Helpers.remote_url
|
@@ -325,7 +328,12 @@ module Cnvrg
|
|
325
328
|
workers:workers,file_input:file_input})
|
326
329
|
return response
|
327
330
|
end
|
331
|
+
def list_commits
|
332
|
+
response = Cnvrg::API.request("users/#{self.owner}/projects/#{self.slug}/commits/list", 'GET')
|
333
|
+
CLI.is_response_success(response)
|
334
|
+
return response
|
328
335
|
|
336
|
+
end
|
329
337
|
def update_idx_with_commit!(commit)
|
330
338
|
idx_hash = YAML.load_file("#{self.local_path}/.cnvrg/idx.yml")
|
331
339
|
idx_hash[:commit] = commit
|
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: 0.0.
|
4
|
+
version: 0.0.1422
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yochay Ettun
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-06-
|
12
|
+
date: 2017-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|