arvados-cli 0.1.20170705224752 → 0.1.20170707131357

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/arv-run-pipeline-instance +35 -15
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd61bcaeba29df93aaac1504ee7038a02a494224
4
- data.tar.gz: 0c6d666dd4c1c82ad79ae5a8573b456b6a1337d1
3
+ metadata.gz: 97740a9d3dc44ebf2d0487719bf639c518120ccb
4
+ data.tar.gz: 3e9c8b109e99733ca6bb2e292904965b876fb689
5
5
  SHA512:
6
- metadata.gz: 397aa164b8ad49012b982e527b7d5c36f3214671923c8e11330ccfaa7dcbf010ada111a4eb08661776141bf0274188f138ab74444f78459e5fdc54658061bd89
7
- data.tar.gz: fc00a28b26b4a2e163e6f8e291a73a03150bb5c9f7adfea710d56bf5faa2a8d9939d6f8e5eaa304aaeaee1caca6b9b7e6bf12711da231ea4db37dbf4db38502b
6
+ metadata.gz: 34f1c460fc864f95528a2c22837a5db8d275bba50bc76ae5b84e479be371b2e7fddfa04d9dd8f2aefb7dea42a109a1e0cc2ab959e49f143d93b0f16521bb23fb
7
+ data.tar.gz: 54cd1c39f5619a41e72d288e7252c4a4f621f3508828f2f14553bd9384f2e62ba30c7bb79c61fb8adcae01e2499e551623e32936881ebe22716fcd969c05d44a
@@ -260,31 +260,46 @@ class JobCache
260
260
  []
261
261
  end
262
262
  end
263
+
264
+ # create() returns [job, exception]. If both job and exception are
265
+ # nil, there was a non-retryable error and the call should not be
266
+ # attempted again.
263
267
  def self.create(pipeline, component, job, create_params)
264
268
  @cache ||= {}
265
269
 
266
270
  body = {job: no_nil_values(job)}.merge(no_nil_values(create_params))
267
271
 
268
- result = $client.execute(:api_method => $arvados.jobs.create,
269
- :body_object => body,
270
- :authenticated => false,
271
- :headers => {
272
- authorization: 'OAuth2 '+$arv.config['ARVADOS_API_TOKEN']
273
- })
274
- j = JSON.parse result.body, :symbolize_names => true
275
- if j.is_a? Hash and j[:uuid]
272
+ result = nil
273
+ begin
274
+ result = $client.execute(
275
+ :api_method => $arvados.jobs.create,
276
+ :body_object => body,
277
+ :authenticated => false,
278
+ :headers => {
279
+ authorization: 'OAuth2 '+$arv.config['ARVADOS_API_TOKEN']
280
+ })
281
+ if result.status == 429 || result.status >= 500
282
+ raise Exception.new("HTTP status #{result.status}")
283
+ end
284
+ rescue Exception => e
285
+ return nil, e
286
+ end
287
+ j = JSON.parse(result.body, :symbolize_names => true) rescue nil
288
+ if result.status == 200 && j.is_a?(Hash) && j[:uuid]
276
289
  @cache[j[:uuid]] = j
290
+ return j, nil
277
291
  else
278
- debuglog "create job: #{j[:errors] rescue nil} with attributes #{body}", 0
292
+ errors = j[:errors] rescue []
293
+ debuglog "create job: [#{result.status}] #{errors.inspect} with attributes #{body}", 0
279
294
 
280
295
  msg = ""
281
- j[:errors].each do |err|
296
+ errors.each do |err|
282
297
  msg += "Error creating job for component #{component}: #{err}\n"
283
298
  end
284
299
  msg += "Job submission was: #{body.to_json}"
285
300
 
286
301
  pipeline.log_stderr(msg)
287
- nil
302
+ return nil, nil
288
303
  end
289
304
  end
290
305
 
@@ -396,7 +411,10 @@ class WhRunPipelineInstance
396
411
  end
397
412
  end
398
413
  if !errors.empty?
399
- abort "\n#{Time.now} -- pipeline_template #{@template[:uuid]}\nErrors:\n#{errors.collect { |c,p,e| "#{c}::#{p} - #{e}\n" }.join ""}"
414
+ all_errors = errors.collect do |c,p,e|
415
+ "#{c}::#{p} - #{e}\n"
416
+ end.join("")
417
+ abort "\n#{Time.now} -- pipeline_template #{@template[:uuid]}\nErrors:\n#{all_errors}"
400
418
  end
401
419
  debuglog "options=" + @options.pretty_inspect
402
420
  self
@@ -463,7 +481,7 @@ class WhRunPipelineInstance
463
481
  # are fully specified (any output_of script_parameters are resolved
464
482
  # to real value)
465
483
  my_submit_id = "instance #{@instance[:uuid]} rand #{rand(2**64).to_s(36)}"
466
- job = JobCache.create(@instance, cname, {
484
+ job, err = JobCache.create(@instance, cname, {
467
485
  :script => c[:script],
468
486
  :script_parameters => Hash[c[:script_parameters].map do |key, spec|
469
487
  [key, spec[:value]]
@@ -490,9 +508,11 @@ class WhRunPipelineInstance
490
508
  c[:job] = job
491
509
  c[:run_in_process] = (@options[:run_jobs_here] and
492
510
  job[:submit_id] == my_submit_id)
493
- else
511
+ elsif err.nil?
494
512
  debuglog "component #{cname} new job failed", 0
495
513
  job_creation_failed += 1
514
+ else
515
+ debuglog "component #{cname} new job failed, err=#{err}", 0
496
516
  end
497
517
  end
498
518
 
@@ -657,7 +677,7 @@ class WhRunPipelineInstance
657
677
  @instance[:state] = 'Complete'
658
678
  else
659
679
  @instance[:state] = 'Paused'
660
- end
680
+ end
661
681
  else
662
682
  if ended == @components.length or failed > 0
663
683
  @instance[:state] = success ? 'Complete' : 'Failed'
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.20170705224752
4
+ version: 0.1.20170707131357
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvados Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-05 00:00:00.000000000 Z
11
+ date: 2017-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arvados
@@ -164,7 +164,7 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0.8'
167
- description: Arvados command line tools, git commit c5b9f2d232a7c5a4d85fea4f36b99eb0c5330cca
167
+ description: Arvados command line tools, git commit e2b3986edaa262ad49c3ef74a75518611776c2cf
168
168
  email: gem-dev@curoverse.com
169
169
  executables:
170
170
  - arv