arvados-cli 0.1.20150930141818 → 0.1.20151015194711
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/bin/arv +75 -29
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecb7ca2ad7208acc3fadfb4e90752a224ba36c95
|
4
|
+
data.tar.gz: 55ea27943c76698d5bf316914fc332b171e475e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9471f8ffba3ace95bc12d3c1c1feb67133da3b61609c2d2c3abb389189c372d86f189ec9100e0bf61820bc6bd122c29435da19c0cdc58a5f8ddc176efc381991
|
7
|
+
data.tar.gz: 231055e48f5a21ec91e1f4ac7e834801afcf829125ec391ee2518d9632d877eca4f2abf48ed91a845dfdc4f847db8fcb73007e15c2583c7e85870f2ae97bbcc2
|
data/bin/arv
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
# Ward Vandewege <ward@curoverse.com>
|
6
6
|
|
7
7
|
require 'fileutils'
|
8
|
+
require 'shellwords'
|
8
9
|
|
9
10
|
if RUBY_VERSION < '1.9.3' then
|
10
11
|
abort <<-EOS
|
@@ -85,7 +86,15 @@ def init_config
|
|
85
86
|
end
|
86
87
|
|
87
88
|
|
88
|
-
subcommands = %w(copy create edit keep pipeline run tag ws)
|
89
|
+
subcommands = %w(copy create edit get keep pipeline run tag ws)
|
90
|
+
|
91
|
+
def exec_bin bin, opts
|
92
|
+
bin_path = `which #{bin.shellescape}`.strip
|
93
|
+
if bin_path.empty?
|
94
|
+
raise "#{bin}: command not found"
|
95
|
+
end
|
96
|
+
exec bin_path, *opts
|
97
|
+
end
|
89
98
|
|
90
99
|
def check_subcommands client, arvados, subcommand, global_opts, remaining_opts
|
91
100
|
case subcommand
|
@@ -93,15 +102,17 @@ def check_subcommands client, arvados, subcommand, global_opts, remaining_opts
|
|
93
102
|
arv_create client, arvados, global_opts, remaining_opts
|
94
103
|
when 'edit'
|
95
104
|
arv_edit client, arvados, global_opts, remaining_opts
|
105
|
+
when 'get'
|
106
|
+
arv_get client, arvados, global_opts, remaining_opts
|
96
107
|
when 'copy', 'tag', 'ws', 'run'
|
97
|
-
|
108
|
+
exec_bin "arv-#{subcommand}", remaining_opts
|
98
109
|
when 'keep'
|
99
110
|
@sub = remaining_opts.shift
|
100
111
|
if ['get', 'put', 'ls', 'normalize'].index @sub then
|
101
112
|
# Native Arvados
|
102
|
-
|
113
|
+
exec_bin "arv-#{@sub}", remaining_opts
|
103
114
|
elsif @sub == 'docker'
|
104
|
-
|
115
|
+
exec_bin "arv-keepdocker", remaining_opts
|
105
116
|
else
|
106
117
|
puts "Usage: arv keep [method] [--parameters]\n"
|
107
118
|
puts "Use 'arv keep [method] --help' to get more information about specific methods.\n\n"
|
@@ -111,7 +122,7 @@ def check_subcommands client, arvados, subcommand, global_opts, remaining_opts
|
|
111
122
|
when 'pipeline'
|
112
123
|
sub = remaining_opts.shift
|
113
124
|
if sub == 'run'
|
114
|
-
|
125
|
+
exec_bin "arv-run-pipeline-instance", remaining_opts
|
115
126
|
else
|
116
127
|
puts "Usage: arv pipeline [method] [--parameters]\n"
|
117
128
|
puts "Use 'arv pipeline [method] --help' to get more information about specific methods.\n\n"
|
@@ -147,14 +158,7 @@ end
|
|
147
158
|
|
148
159
|
def edit_and_commit_object initial_obj, tmp_stem, global_opts, &block
|
149
160
|
|
150
|
-
content =
|
151
|
-
when 'json'
|
152
|
-
Oj.dump(initial_obj, :indent => 1)
|
153
|
-
when 'yaml'
|
154
|
-
initial_obj.to_yaml
|
155
|
-
else
|
156
|
-
abort "Unrecognized format #{global_opts[:format]}"
|
157
|
-
end
|
161
|
+
content = get_obj_content initial_obj, global_opts
|
158
162
|
|
159
163
|
tmp_file = Tempfile.new([tmp_stem, ".#{global_opts[:format]}"])
|
160
164
|
tmp_file.write(content)
|
@@ -179,6 +183,8 @@ def edit_and_commit_object initial_obj, tmp_stem, global_opts, &block
|
|
179
183
|
Oj.load(newcontent)
|
180
184
|
when 'yaml'
|
181
185
|
YAML.load(newcontent)
|
186
|
+
else
|
187
|
+
abort "Unrecognized format #{global_opts[:format]}"
|
182
188
|
end
|
183
189
|
|
184
190
|
yield newobj
|
@@ -243,20 +249,7 @@ def check_response result
|
|
243
249
|
results
|
244
250
|
end
|
245
251
|
|
246
|
-
def
|
247
|
-
uuid = remaining_opts.shift
|
248
|
-
if uuid.nil? or uuid == "-h" or uuid == "--help"
|
249
|
-
puts head_banner
|
250
|
-
puts "Usage: arv edit [uuid] [fields...]\n\n"
|
251
|
-
puts "Fetch the specified Arvados object, select the specified fields, \n"
|
252
|
-
puts "open an interactive text editor on a text representation (json or\n"
|
253
|
-
puts "yaml, use --format) and then update the object. Will use 'nano'\n"
|
254
|
-
puts "by default, customize with the EDITOR or VISUAL environment variable.\n"
|
255
|
-
exit 255
|
256
|
-
end
|
257
|
-
|
258
|
-
# determine controller
|
259
|
-
|
252
|
+
def lookup_uuid_rsc arvados, uuid
|
260
253
|
m = /([a-z0-9]{5})-([a-z0-9]{5})-([a-z0-9]{15})/.match uuid
|
261
254
|
if !m
|
262
255
|
if /^[a-f0-9]{32}/.match uuid
|
@@ -279,6 +272,11 @@ def arv_edit client, arvados, global_opts, remaining_opts
|
|
279
272
|
abort "Could not determine resource type #{m[2]}"
|
280
273
|
end
|
281
274
|
|
275
|
+
return rsc
|
276
|
+
end
|
277
|
+
|
278
|
+
def fetch_rsc_obj client, arvados, rsc, uuid, remaining_opts
|
279
|
+
|
282
280
|
begin
|
283
281
|
result = client.execute(:api_method => eval('arvados.' + rsc + '.get'),
|
284
282
|
:parameters => {"uuid" => uuid},
|
@@ -286,15 +284,45 @@ def arv_edit client, arvados, global_opts, remaining_opts
|
|
286
284
|
:headers => {
|
287
285
|
authorization: 'OAuth2 '+ENV['ARVADOS_API_TOKEN']
|
288
286
|
})
|
289
|
-
|
287
|
+
obj = check_response result
|
290
288
|
rescue => e
|
291
289
|
abort "Server error: #{e}"
|
292
290
|
end
|
293
291
|
|
294
292
|
if remaining_opts.length > 0
|
295
|
-
|
293
|
+
obj.select! { |k, v| remaining_opts.include? k }
|
294
|
+
end
|
295
|
+
|
296
|
+
return obj
|
297
|
+
end
|
298
|
+
|
299
|
+
def get_obj_content obj, global_opts
|
300
|
+
content = case global_opts[:format]
|
301
|
+
when 'json'
|
302
|
+
Oj.dump(obj, :indent => 1)
|
303
|
+
when 'yaml'
|
304
|
+
obj.to_yaml
|
305
|
+
else
|
306
|
+
abort "Unrecognized format #{global_opts[:format]}"
|
307
|
+
end
|
308
|
+
return content
|
309
|
+
end
|
310
|
+
|
311
|
+
def arv_edit client, arvados, global_opts, remaining_opts
|
312
|
+
uuid = remaining_opts.shift
|
313
|
+
if uuid.nil? or uuid == "-h" or uuid == "--help"
|
314
|
+
puts head_banner
|
315
|
+
puts "Usage: arv edit [uuid] [fields...]\n\n"
|
316
|
+
puts "Fetch the specified Arvados object, select the specified fields, \n"
|
317
|
+
puts "open an interactive text editor on a text representation (json or\n"
|
318
|
+
puts "yaml, use --format) and then update the object. Will use 'nano'\n"
|
319
|
+
puts "by default, customize with the EDITOR or VISUAL environment variable.\n"
|
320
|
+
exit 255
|
296
321
|
end
|
297
322
|
|
323
|
+
rsc = lookup_uuid_rsc arvados, uuid
|
324
|
+
oldobj = fetch_rsc_obj client, arvados, rsc, uuid, remaining_opts
|
325
|
+
|
298
326
|
edit_and_commit_object oldobj, uuid, global_opts do |newobj|
|
299
327
|
newobj.select! {|k| newobj[k] != oldobj[k]}
|
300
328
|
if !newobj.empty?
|
@@ -315,6 +343,24 @@ def arv_edit client, arvados, global_opts, remaining_opts
|
|
315
343
|
exit 0
|
316
344
|
end
|
317
345
|
|
346
|
+
def arv_get client, arvados, global_opts, remaining_opts
|
347
|
+
uuid = remaining_opts.shift
|
348
|
+
if uuid.nil? or uuid == "-h" or uuid == "--help"
|
349
|
+
puts head_banner
|
350
|
+
puts "Usage: arv [--format json|yaml] get [uuid] [fields...]\n\n"
|
351
|
+
puts "Fetch the specified Arvados object, select the specified fields,\n"
|
352
|
+
puts "and print a text representation.\n"
|
353
|
+
exit 255
|
354
|
+
end
|
355
|
+
|
356
|
+
rsc = lookup_uuid_rsc arvados, uuid
|
357
|
+
obj = fetch_rsc_obj client, arvados, rsc, uuid, remaining_opts
|
358
|
+
content = get_obj_content obj, global_opts
|
359
|
+
|
360
|
+
puts content
|
361
|
+
exit 0
|
362
|
+
end
|
363
|
+
|
318
364
|
def arv_create client, arvados, global_opts, remaining_opts
|
319
365
|
types = resource_types(arvados.discovery_document)
|
320
366
|
create_opts = Trollop::options do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arvados-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.20151015194711
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arvados Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arvados
|
@@ -178,7 +178,7 @@ dependencies:
|
|
178
178
|
- - "<"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: 1.0.0
|
181
|
-
description: Arvados command line tools, git commit
|
181
|
+
description: Arvados command line tools, git commit ce30948199736d45112ee9103642c22f59f84997
|
182
182
|
email: gem-dev@curoverse.com
|
183
183
|
executables:
|
184
184
|
- arv
|