arvados-cli 0.1.20131212092848 → 0.1.20131212114626
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/arv +79 -72
- data/bin/crunch-job +3 -3
- 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: adcbf46744882d3627d04daacd2f17a21b63d3fd
|
4
|
+
data.tar.gz: de0e2824b4aaba2ab0889a72cd9518b7ee3da632
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a5e0ab558f868fe8000ec2fe9e3a101824f4b1345dc2042aab3f805fe619d7e886d66e9428810c4dbf761c759d0a53736ed13cb36f577fb971b054dc7115e42
|
7
|
+
data.tar.gz: 87fd23b7ad22fbbaad8f113c89b2069c4b9ee4d1561efa3e6f64b0354edde12c43c65cd9c16196e245a8d1f3d9d6a3c2004370439e4e1aeb093291fffc112ee8
|
data/bin/arv
CHANGED
@@ -120,6 +120,47 @@ def to_boolean(s)
|
|
120
120
|
!!(s =~ /^(true|t|yes|y|1)$/i)
|
121
121
|
end
|
122
122
|
|
123
|
+
def help_methods(discovery_document, resource_arg, method=nil)
|
124
|
+
banner = "\n\n"
|
125
|
+
banner += "The #{resource_arg} resource type supports the following methods:"
|
126
|
+
banner += "\n\n"
|
127
|
+
discovery_document["resources"][resource_arg.pluralize]["methods"].
|
128
|
+
each do |k,v|
|
129
|
+
description = ''
|
130
|
+
description = ' ' + v["description"] if v.include?("description")
|
131
|
+
banner += " #{sprintf("%20s",k)}#{description}\n"
|
132
|
+
end
|
133
|
+
banner += "\n"
|
134
|
+
STDERR.puts banner
|
135
|
+
|
136
|
+
if not method.nil? and method != '--help' then
|
137
|
+
Trollop::die ("Unknown method #{method.inspect} " +
|
138
|
+
"for resource #{resource_arg.inspect}")
|
139
|
+
end
|
140
|
+
exit 255
|
141
|
+
end
|
142
|
+
|
143
|
+
def help_resources(discovery_document, resource_arg)
|
144
|
+
banner = "\n\n"
|
145
|
+
banner += "This Arvados instance supports the following resource types:"
|
146
|
+
banner += "\n\n"
|
147
|
+
discovery_document["resources"].each do |k,v|
|
148
|
+
description = ''
|
149
|
+
if discovery_document["schemas"].include?(k.singularize.capitalize) and
|
150
|
+
discovery_document["schemas"][k.singularize.capitalize].include?('description') then
|
151
|
+
description = ' ' + discovery_document["schemas"][k.singularize.capitalize]["description"]
|
152
|
+
end
|
153
|
+
banner += " #{sprintf("%30s",k.singularize)}#{description}\n"
|
154
|
+
end
|
155
|
+
banner += "\n"
|
156
|
+
STDERR.puts banner
|
157
|
+
|
158
|
+
if not resource_arg.nil? and resource_arg != '--help' then
|
159
|
+
Trollop::die "Unknown resource type #{resource_arg.inspect}"
|
160
|
+
end
|
161
|
+
exit 255
|
162
|
+
end
|
163
|
+
|
123
164
|
def parse_arguments(discovery_document)
|
124
165
|
resource_types = Array.new()
|
125
166
|
resource_types << '--help'
|
@@ -138,85 +179,51 @@ def parse_arguments(discovery_document)
|
|
138
179
|
stop_on resource_types
|
139
180
|
end
|
140
181
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
# Now see if the method supplied exists
|
146
|
-
method = ARGV.shift
|
147
|
-
if discovery_document["resources"][resource_arg.pluralize]["methods"].include?(method) then
|
148
|
-
# method exists. Collect arguments.
|
149
|
-
discovered_params = discovery_document["resources"][resource_arg.pluralize]["methods"][method]["parameters"]
|
150
|
-
method_opts = Trollop::options do
|
151
|
-
discovered_params.each do |k,v|
|
152
|
-
opts = Hash.new()
|
153
|
-
opts[:type] = v["type"].to_sym if v.include?("type")
|
154
|
-
if [:datetime, :text, :object, :array].index opts[:type]
|
155
|
-
opts[:type] = :string # else trollop bork
|
156
|
-
end
|
157
|
-
opts[:default] = v["default"] if v.include?("default")
|
158
|
-
opts[:default] = v["default"].to_i if opts[:type] == :integer
|
159
|
-
opts[:default] = to_boolean(v["default"]) if opts[:type] == :boolean
|
160
|
-
opts[:required] = true if v.include?("required") and v["required"]
|
161
|
-
description = ''
|
162
|
-
description = ' ' + v["description"] if v.include?("description")
|
163
|
-
opt k.to_sym, description, opts
|
164
|
-
end
|
165
|
-
body_object = discovery_document["resources"][resource_arg.pluralize]["methods"][method]["request"]
|
166
|
-
if body_object and discovered_params[resource_arg].nil?
|
167
|
-
is_required = true
|
168
|
-
if body_object["required"] == false
|
169
|
-
is_required = false
|
170
|
-
end
|
171
|
-
opt resource_arg.to_sym, "#{resource_arg} (request body)", required: is_required, type: :string
|
172
|
-
end
|
173
|
-
end
|
174
|
-
discovered_params.each do |k,v|
|
175
|
-
if ['object', 'array'].index(v["type"]) and method_opts.has_key? k
|
176
|
-
method_opts[k] = JSON.parse method_opts[k]
|
177
|
-
end
|
178
|
-
end
|
179
|
-
else
|
180
|
-
banner = "\nThis resource type supports the following methods:\n\n"
|
181
|
-
discovery_document["resources"][resource_arg.pluralize]["methods"].each do |k,v|
|
182
|
-
description = ''
|
183
|
-
description = ' ' + v["description"] if v.include?("description")
|
184
|
-
banner += " #{sprintf("%20s",k)}#{description}\n"
|
185
|
-
end
|
186
|
-
banner += "\n"
|
182
|
+
resource = ARGV.shift
|
183
|
+
if resource == '--help' or not resource_types.include?(resource)
|
184
|
+
help_resources(discovery_document, resource)
|
185
|
+
end
|
187
186
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
exit 255
|
194
|
-
end
|
187
|
+
method = ARGV.shift
|
188
|
+
if not (discovery_document["resources"][resource.pluralize]["methods"].
|
189
|
+
include?(method))
|
190
|
+
help_methods(discovery_document, resource, method)
|
191
|
+
end
|
195
192
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
193
|
+
discovered_params = (discovery_document
|
194
|
+
["resources"][resource.pluralize]
|
195
|
+
["methods"][method]
|
196
|
+
["parameters"])
|
197
|
+
method_opts = Trollop::options do
|
198
|
+
discovered_params.each do |k,v|
|
199
|
+
opts = Hash.new()
|
200
|
+
opts[:type] = v["type"].to_sym if v.include?("type")
|
201
|
+
if [:datetime, :text, :object, :array].index opts[:type]
|
202
|
+
opts[:type] = :string # else trollop bork
|
203
|
+
end
|
204
|
+
opts[:default] = v["default"] if v.include?("default")
|
205
|
+
opts[:default] = v["default"].to_i if opts[:type] == :integer
|
206
|
+
opts[:default] = to_boolean(v["default"]) if opts[:type] == :boolean
|
207
|
+
opts[:required] = true if v.include?("required") and v["required"]
|
201
208
|
description = ''
|
202
|
-
|
203
|
-
|
204
|
-
|
209
|
+
description = ' ' + v["description"] if v.include?("description")
|
210
|
+
opt k.to_sym, description, opts
|
211
|
+
end
|
212
|
+
body_object = discovery_document["resources"][resource.pluralize]["methods"][method]["request"]
|
213
|
+
if body_object and discovered_params[resource].nil?
|
214
|
+
is_required = true
|
215
|
+
if body_object["required"] == false
|
216
|
+
is_required = false
|
205
217
|
end
|
206
|
-
|
218
|
+
opt resource.to_sym, "#{resource} (request body)", required: is_required, type: :string
|
207
219
|
end
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
if not resource_arg.nil? and resource_arg != '--help' then
|
213
|
-
Trollop::die "Unknown resource type #{resource_arg.inspect}"
|
214
|
-
else
|
215
|
-
exit 255
|
220
|
+
end
|
221
|
+
discovered_params.each do |k,v|
|
222
|
+
if ['object', 'array'].index(v["type"]) and method_opts.has_key? k
|
223
|
+
method_opts[k] = JSON.parse method_opts[k]
|
216
224
|
end
|
217
225
|
end
|
218
|
-
|
219
|
-
return resource_arg, method, method_opts, global_opts, ARGV
|
226
|
+
return resource, method, method_opts, global_opts, ARGV
|
220
227
|
end
|
221
228
|
|
222
229
|
resource_schema, method, method_opts, global_opts, remaining_opts = parse_arguments(arvados.discovery_document)
|
data/bin/crunch-job
CHANGED
@@ -341,13 +341,13 @@ else
|
|
341
341
|
Log (undef, "Install revision ".$Job->{script_version});
|
342
342
|
my $nodelist = join(",", @node);
|
343
343
|
|
344
|
-
# Clean out crunch_tmp/work, crunch_tmp/opt, crunch_tmp/src
|
344
|
+
# Clean out crunch_tmp/work, crunch_tmp/opt, crunch_tmp/src*
|
345
345
|
|
346
346
|
my $cleanpid = fork();
|
347
347
|
if ($cleanpid == 0)
|
348
348
|
{
|
349
349
|
srun (["srun", "--nodelist=$nodelist", "-D", $ENV{'TMPDIR'}],
|
350
|
-
['bash', '-c', 'if mount | grep -q $JOB_WORK/; then sudo /bin/umount $JOB_WORK/* 2>/dev/null; fi; sleep 1; rm -rf $JOB_WORK $CRUNCH_TMP/opt $CRUNCH_TMP/src']);
|
350
|
+
['bash', '-c', 'if mount | grep -q $JOB_WORK/; then sudo /bin/umount $JOB_WORK/* 2>/dev/null; fi; sleep 1; rm -rf $JOB_WORK $CRUNCH_TMP/opt $CRUNCH_TMP/src*']);
|
351
351
|
exit (1);
|
352
352
|
}
|
353
353
|
while (1)
|
@@ -1351,7 +1351,7 @@ my $repo = $ENV{"CRUNCH_SRC_URL"};
|
|
1351
1351
|
|
1352
1352
|
open L, ">", "$destdir.lock" or die "$destdir.lock: $!";
|
1353
1353
|
flock L, LOCK_EX;
|
1354
|
-
if (readlink ("$destdir.commit") eq $commit) {
|
1354
|
+
if (readlink ("$destdir.commit") eq $commit && -d $destdir) {
|
1355
1355
|
exit 0;
|
1356
1356
|
}
|
1357
1357
|
|
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.20131212114626
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arvados Authors
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 2.0.3
|
97
|
-
description: This is the Arvados SDK CLI gem, git revision
|
97
|
+
description: This is the Arvados SDK CLI gem, git revision b0f21e25fac7bfc359c0c284805ef2723d7dcc72
|
98
98
|
email: gem-dev@clinicalfuture.com
|
99
99
|
executables:
|
100
100
|
- arv
|