Moves API token authentication from ApplicationController into ArvadosApiToken Rack...
[arvados.git] / services / api / app / models / pipeline_instance.rb
index 6de861d00547297688fdba19aee5c72d2d05e83e..b16769cb3cbe868548834c919d45499d2117f051 100644 (file)
@@ -1,16 +1,15 @@
-class PipelineInstance < OrvosModel
+class PipelineInstance < ArvadosModel
   include AssignUuid
   include KindAndEtag
   include CommonApiTemplate
   serialize :components, Hash
   serialize :properties, Hash
   belongs_to :pipeline_template, :foreign_key => :pipeline_template_uuid, :primary_key => :uuid
-  attr_accessor :pipeline_template
 
   before_validation :bootstrap_components
   before_validation :update_success
 
-  api_accessible :superuser, :extend => :common do |t|
+  api_accessible :user, extend: :common do |t|
     t.add :pipeline_template_uuid
     t.add :pipeline_template, :if => :pipeline_template
     t.add :name
@@ -18,6 +17,7 @@ class PipelineInstance < OrvosModel
     t.add :success
     t.add :active
     t.add :dependencies
+    t.add :properties
   end
 
   def dependencies
@@ -60,10 +60,14 @@ class PipelineInstance < OrvosModel
     t.collect { |r| r[2] }.inject(0.0) { |sum,a| sum += a } / t.size
   end
 
+  def self.queue
+    self.where('active = true')
+  end
+
   protected
   def bootstrap_components
     if pipeline_template and (!components or components.empty?)
-      self.components = pipeline_template.components
+      self.components = pipeline_template.components.deep_dup
     end
   end