arvados-cli 0.1.20140813140640 → 0.1.20140813163950

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/arv-run-pipeline-instance +40 -17
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22110a572737a88fb8e942d35638ec83ea8b7a2f
4
- data.tar.gz: b622e9fb6b2819979b86ae00061fb43e101568e0
3
+ metadata.gz: b37b987ad9590136675ca8f33824071d47695fb7
4
+ data.tar.gz: af38929fb8566e70449a85eeb6a897a4ae0f9b74
5
5
  SHA512:
6
- metadata.gz: 78f1cd06ff3890a5ec0ae688a6ce2eeb2110dca97e2d36762398b1c738929154fa6cf0c2fe8cc88ae83cf3ff8b96630b5ca3411f5577798c039d01b1fd264e05
7
- data.tar.gz: c74ca1d11da26709874d4af8d1877871f6040bc7d5cad3350e9c3a6c8c23dcad0d46fbae981ce305e1e7dc49f819112584d2148e8722dfd01bc806eb64cf1da2
6
+ metadata.gz: fbae3de1461375f0efbdf8cbf38de5170c4e33e408cd883d9f6ae524de567b39c05bd3993a37b93ac090d942212f909d11bbe7cc342547ea872205638e4a38ba
7
+ data.tar.gz: dcaafc1451a75704bc13835aa131419a7741f14e9e41d07c52e6467d99645ee8cfaf20ea74f9868acb0d96514a82fc53e9a1b955c26b6c2e869a3c31f6937afc
@@ -285,6 +285,16 @@ class PipelineInstance
285
285
  def [](x)
286
286
  @pi[x]
287
287
  end
288
+
289
+ def log_stderr(msg)
290
+ $arv.log.create log: {
291
+ event_type: 'stderr',
292
+ object_uuid: self[:uuid],
293
+ owner_uuid: self[:owner_uuid],
294
+ properties: {"text" => msg},
295
+ }
296
+ end
297
+
288
298
  protected
289
299
  def initialize(j)
290
300
  @attributes_to_update = {}
@@ -345,19 +355,7 @@ class JobCache
345
355
  end
346
356
  msg += "Job submission was: #{body.to_json}"
347
357
 
348
- $client.execute(:api_method => $arvados.logs.create,
349
- :body_object => {
350
- :log => {
351
- :object_uuid => pipeline[:uuid],
352
- :event_type => 'stderr',
353
- :owner_uuid => pipeline[:owner_uuid],
354
- :properties => {"text" => msg}
355
- }
356
- },
357
- :authenticated => false,
358
- :headers => {
359
- authorization: 'OAuth2 '+ENV['ARVADOS_API_TOKEN']
360
- })
358
+ pipeline.log_stderr(msg)
361
359
  nil
362
360
  end
363
361
  end
@@ -380,10 +378,6 @@ class WhRunPipelineInstance
380
378
  if template.match /[^-0-9a-z]/
381
379
  # Doesn't look like a uuid -- use it as a filename.
382
380
  @template = JSON.parse File.read(template), :symbolize_names => true
383
- if !@template[:components]
384
- abort ("#{$0}: Template loaded from #{template} " +
385
- "does not have a \"components\" key")
386
- end
387
381
  else
388
382
  result = $client.execute(:api_method => $arvados.pipeline_templates.get,
389
383
  :parameters => {
@@ -422,8 +416,25 @@ class WhRunPipelineInstance
422
416
  end
423
417
  end
424
418
 
419
+ if not @template[:components].is_a?(Hash)
420
+ abort "\n#{Time.now} -- pipeline_template #{@template[:uuid]}\nSyntax error: Template missing \"components\" hash"
421
+ end
425
422
  @components = @template[:components].dup
426
423
 
424
+ bad_components = @components.each_pair.select do |cname, cspec|
425
+ not cspec.is_a?(Hash)
426
+ end
427
+ if bad_components.any?
428
+ abort "\n#{Time.now} -- pipeline_template #{@template[:uuid]}\nSyntax error: Components not specified with hashes: #{bad_components.map(&:first).join(', ')}"
429
+ end
430
+
431
+ bad_components = @components.each_pair.select do |cname, cspec|
432
+ not cspec[:script_parameters].is_a?(Hash)
433
+ end
434
+ if bad_components.any?
435
+ abort "\n#{Time.now} -- pipeline_template #{@template[:uuid]}\nSyntax error: Components missing \"script_parameters\" hashes: #{bad_components.map(&:first).join(', ')}"
436
+ end
437
+
427
438
  errors = []
428
439
  @components.each do |componentname, component|
429
440
  component[:script_parameters].each do |parametername, parameter|
@@ -711,6 +722,18 @@ class WhRunPipelineInstance
711
722
  end
712
723
  end
713
724
  end
725
+
726
+ def abort(msg)
727
+ if @instance
728
+ if ["New", "Ready", "RunningOnClient",
729
+ "RunningOnServer"].include?(@instance[:state])
730
+ @instance[:state] = "Failed"
731
+ @instance.save
732
+ end
733
+ @instance.log_stderr(msg)
734
+ end
735
+ Kernel::abort(msg)
736
+ end
714
737
  end
715
738
 
716
739
  runner = WhRunPipelineInstance.new($options)
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.20140813140640
4
+ version: 0.1.20140813163950
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvados Authors
@@ -166,7 +166,7 @@ dependencies:
166
166
  - - "<"
167
167
  - !ruby/object:Gem::Version
168
168
  version: 1.0.0
169
- description: This is the Arvados SDK CLI gem, git revision 3cc80b447efcaf416ea4d6857d6d40583e462ff8
169
+ description: This is the Arvados SDK CLI gem, git revision 7482410350df49dbddab05448b167bf61f14d71e
170
170
  email: gem-dev@curoverse.com
171
171
  executables:
172
172
  - arv