arvados-cli 0.1.20130730143934 → 0.1.20130916215921
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/arv +25 -3
- data/bin/arv-run-pipeline-instance +8 -4
- metadata +3 -3
data/bin/arv
CHANGED
@@ -149,6 +149,14 @@ def parse_arguments(discovery_document)
|
|
149
149
|
description = ' ' + v["description"] if v.include?("description")
|
150
150
|
opt k.to_sym, description, opts
|
151
151
|
end
|
152
|
+
body_object = discovery_document["resources"][resource_arg.pluralize]["methods"][method]["request"]
|
153
|
+
if body_object and discovered_params[resource_arg].nil?
|
154
|
+
is_required = true
|
155
|
+
if body_object["required"] == false
|
156
|
+
is_required = false
|
157
|
+
end
|
158
|
+
opt resource_arg.to_sym, "#{resource_arg} (request body)", required: is_required, type: :string
|
159
|
+
end
|
152
160
|
end
|
153
161
|
discovered_params.each do |k,v|
|
154
162
|
if ['object', 'array'].index(v["type"]) and method_opts.has_key? k
|
@@ -195,10 +203,11 @@ def parse_arguments(discovery_document)
|
|
195
203
|
end
|
196
204
|
end
|
197
205
|
|
198
|
-
return resource_arg
|
206
|
+
return resource_arg, method, method_opts, global_opts, ARGV
|
199
207
|
end
|
200
208
|
|
201
|
-
|
209
|
+
resource_schema, method, method_opts, global_opts, remaining_opts = parse_arguments(arvados.discovery_document)
|
210
|
+
controller = resource_schema.pluralize
|
202
211
|
|
203
212
|
api_method = 'arvados.' + controller + '.' + method
|
204
213
|
|
@@ -209,7 +218,20 @@ if global_opts[:dry_run]
|
|
209
218
|
exit
|
210
219
|
end
|
211
220
|
|
212
|
-
|
221
|
+
request_parameters = {}.merge(method_opts)
|
222
|
+
resource_body = request_parameters.delete(resource_schema.to_sym)
|
223
|
+
if resource_body
|
224
|
+
request_body = {
|
225
|
+
resource_schema => JSON.parse(resource_body)
|
226
|
+
}
|
227
|
+
else
|
228
|
+
request_body = {}
|
229
|
+
end
|
230
|
+
request_body[:api_token] = ENV['ARVADOS_API_TOKEN']
|
231
|
+
result = client.execute(:api_method => eval(api_method),
|
232
|
+
:parameters => request_parameters,
|
233
|
+
:body => request_body,
|
234
|
+
:authenticated => false)
|
213
235
|
results = JSON.parse result.body
|
214
236
|
|
215
237
|
if results["errors"] then
|
@@ -201,9 +201,11 @@ class PipelineInstance
|
|
201
201
|
def self.find(uuid)
|
202
202
|
result = $client.execute(:api_method => $arvados.pipeline_instances.get,
|
203
203
|
:parameters => {
|
204
|
-
:api_token => ENV['ARVADOS_API_TOKEN'],
|
205
204
|
:uuid => uuid
|
206
205
|
},
|
206
|
+
:body => {
|
207
|
+
:api_token => ENV['ARVADOS_API_TOKEN']
|
208
|
+
},
|
207
209
|
:authenticated => false)
|
208
210
|
j = JSON.parse result.body, :symbolize_names => true
|
209
211
|
unless j.is_a? Hash and j[:uuid]
|
@@ -216,9 +218,9 @@ class PipelineInstance
|
|
216
218
|
end
|
217
219
|
def self.create(attributes)
|
218
220
|
result = $client.execute(:api_method => $arvados.pipeline_instances.create,
|
219
|
-
:
|
221
|
+
:body => {
|
220
222
|
:api_token => ENV['ARVADOS_API_TOKEN'],
|
221
|
-
:pipeline_instance => attributes
|
223
|
+
:pipeline_instance => attributes
|
222
224
|
},
|
223
225
|
:authenticated => false)
|
224
226
|
j = JSON.parse result.body, :symbolize_names => true
|
@@ -231,8 +233,10 @@ class PipelineInstance
|
|
231
233
|
def save
|
232
234
|
result = $client.execute(:api_method => $arvados.pipeline_instances.update,
|
233
235
|
:parameters => {
|
236
|
+
:uuid => @pi[:uuid]
|
237
|
+
},
|
238
|
+
:body => {
|
234
239
|
:api_token => ENV['ARVADOS_API_TOKEN'],
|
235
|
-
:uuid => @pi[:uuid],
|
236
240
|
:pipeline_instance => @attributes_to_update.to_json
|
237
241
|
},
|
238
242
|
:authenticated => false)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.20130916215921
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-api-client
|
@@ -107,7 +107,7 @@ dependencies:
|
|
107
107
|
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: 2.0.3
|
110
|
-
description: This is the Arvados SDK CLI gem, git revision
|
110
|
+
description: This is the Arvados SDK CLI gem, git revision ef71d0cab582ed90fea0edc9ea2ed94a22946086
|
111
111
|
email: gem-dev@clinicalfuture.com
|
112
112
|
executables:
|
113
113
|
- arv
|