Merge branch 'master' into 4036-combine-collections-in-project-issue
[arvados.git] / apps / workbench / app / controllers / application_controller.rb
index dc8325cc18b17590735e5927c5af4341eed27143..0313111ab9e1f34e75b530b396846111fcc9f568 100644 (file)
@@ -694,24 +694,26 @@ class ApplicationController < ActionController::Base
 
   helper_method :running_pipelines
   def running_pipelines
-    pi = PipelineInstance.order(["started_at asc", "created_at asc"]).filter([["state", "in", ["RunningOnServer"]]])
+    pi = PipelineInstance.order(["started_at asc", "created_at asc"]).filter([["state", "in", ["RunningOnServer", "RunningOnClient"]]])
     jobs = {}
     pi.each do |pl|
       pl.components.each do |k,v|
-        if v[:job]
+        if v.is_a? Hash and v[:job]
           jobs[v[:job][:uuid]] = {}
         end
       end
     end
 
-    Job.filter([["uuid", "in", jobs.keys]]).each do |j|
-      jobs[j[:uuid]] = j
-    end
+    if jobs.keys.any?
+      Job.filter([["uuid", "in", jobs.keys]]).each do |j|
+        jobs[j[:uuid]] = j
+      end
 
-    pi.each do |pl|
-      pl.components.each do |k,v|
-        if v[:job]
-          v[:job] = jobs[v[:job][:uuid]]
+      pi.each do |pl|
+        pl.components.each do |k,v|
+          if v.is_a? Hash and v[:job]
+            v[:job] = jobs[v[:job][:uuid]]
+          end
         end
       end
     end