Merge branch '10674-wb-workflow-defaults' closes #10674
[arvados.git] / apps / workbench / app / models / pipeline_instance.rb
index 6e556d5b75cae13626aad29d1c0a816a5a78b583..e9fa04ab6d09419f7875354a01c26b33c8c0b679 100644 (file)
@@ -13,7 +13,7 @@ class PipelineInstance < ArvadosBase
       template = if lookup and lookup[self.pipeline_template_uuid]
                    lookup[self.pipeline_template_uuid]
                  else
-                   PipelineTemplate.where(uuid: self.pipeline_template_uuid).first
+                   PipelineTemplate.find?(self.pipeline_template_uuid) if self.pipeline_template_uuid
                  end
       if template
         template.name
@@ -132,6 +132,10 @@ class PipelineInstance < ArvadosBase
     end
   end
 
+  def work_unit(label=nil)
+    PipelineInstanceWorkUnit.new(self, label || self.name, self.uuid)
+  end
+
   private
 
   def components_map