arvados-cli 0.1.20140624171100 → 0.1.20140627084759

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93abeb0822dc61cb752c265e5759ecc0ac767093
4
- data.tar.gz: 260099023bf2e48b27c097f704353d7b45d1edd7
3
+ metadata.gz: 06c70fbbfc1414385a57c4cebf5ad43f37d07cd1
4
+ data.tar.gz: 0f4d5a56998d20a5aad7226f378a65222491ae47
5
5
  SHA512:
6
- metadata.gz: 81f11359d86207894e584c21fd0605d02eabd9ff03091f3d166571872e260af4954d8749deec720e8e5a3b4ce98026498863b3f47f3b31d4a032b5f549cc47cb
7
- data.tar.gz: 6f354cd3cc7313058d816662bceb493ac0b1afedce810bc78b0bf960faca86e1a687ee80d387a4c99ed89e1546948b877dff9da04a5baad759683a69d23cdc97
6
+ metadata.gz: 0118d9b84ca1dacb0a3efed6ae994381afb79da89c7de816f0efc1d1f7bbf8ccc6c480236d3682324770dd4e264cb52fddd8b2a8a346beab1b35c011960a1875
7
+ data.tar.gz: 8ddd5031983ead996e4b7c2d77f4ebb3d46ca010c157ddd9612dae22420707ad5b8d7e8024e85531fe550b1bf48e8f501a1d435d54c975b176494db6ef6c491f
data/bin/arv CHANGED
@@ -143,9 +143,14 @@ def check_subcommands client, arvados, subcommand, global_opts, remaining_opts
143
143
  end
144
144
  end
145
145
 
146
+ def arv_edit_save_tmp tmp
147
+ FileUtils::cp tmp.path, tmp.path + ".saved"
148
+ puts "Saved contents to " + tmp.path + ".saved"
149
+ end
150
+
146
151
  def arv_edit client, arvados, global_opts, remaining_opts
147
- n = remaining_opts.shift
148
- if n.nil? or n == "-h" or n == "--help"
152
+ uuid = remaining_opts.shift
153
+ if uuid.nil? or uuid == "-h" or uuid == "--help"
149
154
  puts head_banner
150
155
  puts "Usage: arv edit [uuid] [fields...]\n\n"
151
156
  puts "Fetch the specified Arvados object, select the specified fields, \n"
@@ -162,9 +167,9 @@ def arv_edit client, arvados, global_opts, remaining_opts
162
167
 
163
168
  # determine controller
164
169
 
165
- m = /([a-z0-9]{5})-([a-z0-9]{5})-([a-z0-9]{15})/.match n
170
+ m = /([a-z0-9]{5})-([a-z0-9]{5})-([a-z0-9]{15})/.match uuid
166
171
  if !m
167
- if /^[a-f0-9]{32}/.match n
172
+ if /^[a-f0-9]{32}/.match uuid
168
173
  abort "Arvados collections are not editable."
169
174
  else
170
175
  abort "#{n} does not appear to be an Arvados uuid"
@@ -187,7 +192,7 @@ def arv_edit client, arvados, global_opts, remaining_opts
187
192
  api_method = 'arvados.' + rsc + '.get'
188
193
 
189
194
  result = client.execute(:api_method => eval(api_method),
190
- :parameters => {"uuid" => n},
195
+ :parameters => {"uuid" => uuid},
191
196
  :authenticated => false,
192
197
  :headers => {
193
198
  authorization: 'OAuth2 '+ENV['ARVADOS_API_TOKEN']
@@ -213,7 +218,7 @@ def arv_edit client, arvados, global_opts, remaining_opts
213
218
 
214
219
  require 'tempfile'
215
220
 
216
- tmp = Tempfile.new([n, "." + global_opts[:format]])
221
+ tmp = Tempfile.new([uuid, "." + global_opts[:format]])
217
222
  tmp.write(content)
218
223
  tmp.close
219
224
 
@@ -251,9 +256,13 @@ def arv_edit client, arvados, global_opts, remaining_opts
251
256
  n += 1
252
257
  end
253
258
  puts "\nTry again (y/n)? "
254
- yn = $stdin.read 1
259
+ yn = "X"
260
+ while not ["y", "Y", "n", "N"].include?(yn)
261
+ yn = $stdin.read 1
262
+ end
255
263
  if yn == 'n' or yn == 'N'
256
- exit 1
264
+ arv_edit_save_tmp tmp
265
+ abort
257
266
  end
258
267
  end
259
268
  else
@@ -262,31 +271,45 @@ def arv_edit client, arvados, global_opts, remaining_opts
262
271
  end
263
272
  end
264
273
 
265
- tmp.close(true)
266
-
267
- if newobj != results
268
- api_method = 'arvados.' + rsc + '.update'
269
- dumped = Oj.dump(newobj)
270
- result = client.execute(:api_method => eval(api_method),
271
- :parameters => {"uuid" => n, rsc.singularize => dumped},
272
- :authenticated => false,
273
- :headers => {
274
- authorization: 'OAuth2 '+ENV['ARVADOS_API_TOKEN']
275
- })
276
-
277
- begin
278
- results = JSON.parse result.body
279
- rescue JSON::ParserError => e
280
- abort "Failed to parse server response:\n" + e.to_s
281
- end
274
+ begin
275
+ if newobj != results
276
+ api_method = 'arvados.' + rsc + '.update'
277
+ dumped = Oj.dump(newobj)
282
278
 
283
- if result.response.status != 200
284
- puts "Update failed. Server responded #{result.response.status}: #{results['errors']} "
285
- puts "Update body was:"
286
- puts dumped
279
+ begin
280
+ result = client.execute(:api_method => eval(api_method),
281
+ :parameters => {"uuid" => uuid},
282
+ :body => { rsc.singularize => dumped },
283
+ :authenticated => false,
284
+ :headers => {
285
+ authorization: 'OAuth2 '+ENV['ARVADOS_API_TOKEN']
286
+ })
287
+ rescue Exception => e
288
+ puts "Error communicating with server, error was #{e}"
289
+ puts "Update body was:"
290
+ puts dumped
291
+ arv_edit_save_tmp tmp
292
+ abort
293
+ end
294
+
295
+ begin
296
+ results = JSON.parse result.body
297
+ rescue JSON::ParserError => e
298
+ abort "Failed to parse server response:\n" + e.to_s
299
+ end
300
+
301
+ if result.response.status != 200
302
+ puts "Update failed. Server responded #{result.response.status}: #{results['errors']} "
303
+ puts "Update body was:"
304
+ puts dumped
305
+ arv_edit_save_tmp tmp
306
+ abort
307
+ end
308
+ else
309
+ puts "Object is unchanged, did not update."
287
310
  end
288
- else
289
- puts "Object is unchanged, did not update."
311
+ ensure
312
+ tmp.close(true)
290
313
  end
291
314
 
292
315
  exit 0
@@ -469,6 +469,7 @@ class WhRunPipelineInstance
469
469
  :repository => c[:repository],
470
470
  :nondeterministic => c[:nondeterministic],
471
471
  :output_is_persistent => c[:output_is_persistent] || false,
472
+ :runtime_constraints => c[:runtime_constraints],
472
473
  :owner_uuid => owner_uuid,
473
474
  # TODO: Delete the following three attributes when
474
475
  # supporting pre-20140418 API servers is no longer
@@ -591,7 +592,7 @@ class WhRunPipelineInstance
591
592
  ended += 1
592
593
  if c[:job][:success] == true
593
594
  succeeded += 1
594
- elsif c[:job][:success] == false
595
+ elsif c[:job][:success] == false or c[:job][:cancelled_at]
595
596
  failed += 1
596
597
  end
597
598
  end
data/bin/crunch-job CHANGED
@@ -639,6 +639,7 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
639
639
  my $command =
640
640
  "if [ -e $ENV{TASK_WORK} ]; then rm -rf $ENV{TASK_WORK}; fi; "
641
641
  ."mkdir -p $ENV{JOB_WORK} $ENV{CRUNCH_TMP} $ENV{TASK_WORK} $ENV{TASK_KEEPMOUNT} "
642
+ ."&& chmod og+wrx $ENV{TASK_WORK}"
642
643
  ."&& cd $ENV{CRUNCH_TMP} ";
643
644
  if ($build_script)
644
645
  {
@@ -657,22 +658,36 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
657
658
  $command .=
658
659
  q{$(ip -o address show scope global |
659
660
  gawk 'match($4, /^([0-9\.:]+)\//, x){print "--dns", x[1]}') };
660
- foreach my $env_key (qw(CRUNCH_SRC CRUNCH_TMP TASK_KEEPMOUNT))
661
- {
662
- $command .= "-v \Q$ENV{$env_key}:$ENV{$env_key}:rw\E ";
663
- }
661
+ $command .= "-v \Q$ENV{TASK_WORK}:/tmp/crunch-job:rw\E ";
662
+ $command .= "-v \Q$ENV{CRUNCH_SRC}:/tmp/crunch-src:ro\E ";
663
+ $command .= "-v \Q$ENV{TASK_KEEPMOUNT}:/mnt:ro\E ";
664
664
  while (my ($env_key, $env_val) = each %ENV)
665
665
  {
666
666
  if ($env_key =~ /^(ARVADOS|JOB|TASK)_/) {
667
- $command .= "-e \Q$env_key=$env_val\E ";
667
+ if ($env_key eq "TASK_WORK") {
668
+ $command .= "-e \QTASK_WORK=/tmp/crunch-job\E ";
669
+ }
670
+ elsif ($env_key eq "TASK_KEEPMOUNT") {
671
+ $command .= "-e \QTASK_KEEPMOUNT=/mnt\E ";
672
+ }
673
+ elsif ($env_key eq "CRUNCH_SRC") {
674
+ $command .= "-e \QCRUNCH_SRC=/tmp/crunch-src\E ";
675
+ }
676
+ else {
677
+ $command .= "-e \Q$env_key=$env_val\E ";
678
+ }
668
679
  }
669
680
  }
670
681
  $command .= "\Q$docker_hash\E ";
682
+ $command .= "stdbuf -o0 -e0 ";
683
+ $command .= "/tmp/crunch-src/crunch_scripts/" . $Job->{"script"};
671
684
  } else {
672
- $command .= "crunchstat -cgroup-root=/sys/fs/cgroup -poll=10000 "
685
+ # Non-docker run
686
+ $command .= "crunchstat -cgroup-root=/sys/fs/cgroup -poll=10000 ";
687
+ $command .= "stdbuf -o0 -e0 ";
688
+ $command .= "$ENV{CRUNCH_SRC}/crunch_scripts/" . $Job->{"script"};
673
689
  }
674
- $command .= "stdbuf -o0 -e0 ";
675
- $command .= "$ENV{CRUNCH_SRC}/crunch_scripts/" . $Job->{"script"};
690
+
676
691
  my @execargs = ('bash', '-c', $command);
677
692
  srun (\@srunargs, \@execargs, undef, $build_script_to_send);
678
693
  exit (111);
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.20140624171100
4
+ version: 0.1.20140627084759
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvados Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-24 00:00:00.000000000 Z
11
+ date: 2014-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arvados
@@ -146,7 +146,7 @@ dependencies:
146
146
  - - "~>"
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0.8'
149
- description: This is the Arvados SDK CLI gem, git revision bfc0b74c4f4e5b6485393827735ff9a875d4d8ac
149
+ description: This is the Arvados SDK CLI gem, git revision 377b4f345a5ba45bb96497a6be2b571604a695a1
150
150
  email: gem-dev@curoverse.com
151
151
  executables:
152
152
  - arv