Merge remote-tracking branch 'origin/master' into 2882-job-process-stats
[arvados.git] / apps / workbench / app / helpers / pipeline_instances_helper.rb
index d0caf121199fa2a322dce0ce25eb7922f8970e2c..7b6fb727637fc6dc0e56fac95c303321bf050abc 100644 (file)
@@ -22,12 +22,33 @@ module PipelineInstancesHelper
     pj
   end
 
+  def pipeline_log_history(job_uuids)
+    results = []
+
+    log_history = Log.where(event_type: 'stderr',
+                            object_uuid: job_uuids).order('id DESC')
+    if !log_history.results.empty?
+      reversed_results = log_history.results.reverse
+      reversed_results.each do |entry|
+        if entry.andand.properties
+          properties = entry.properties
+          text = properties[:text]
+          if text
+            results = results.concat text.split("\n")
+          end
+        end
+      end
+    end
+
+    return results
+  end
 
   protected
 
   def pipeline_jobs_newschool object
     ret = []
     i = -1
+
     object.components.each do |cname, c|
       i += 1
       pj = {index: i, name: cname}