1 class PipelineInvocation < ActiveRecord::Base
4 include CommonApiTemplate
5 serialize :components, Hash
6 belongs_to :pipeline, :foreign_key => :pipeline_uuid, :primary_key => :uuid
8 before_validation :bootstrap_components
9 before_validation :update_success
11 api_accessible :superuser, :extend => :common do |t|
23 components['steps'].collect do |step|
25 row = [nrow, step['name']]
26 if step['output_data_locator']
31 row << (step['warehousejob']['id'] rescue nil)
32 row << (step['warehousejob']['revision'] rescue nil)
33 row << step['output_data_locator']
34 row << (Time.parse(step['warehousejob']['finishtime']) rescue nil)
44 return 0 if t.size < 1
45 t.collect { |r| r[2] }.inject(0.0) { |sum,a| sum += a } / t.size
49 def bootstrap_components
50 if pipeline and (!components or components.empty?)
51 self.components = pipeline.components
56 if components and progress_ratio == 1.0