Merge branch '11629-groups-contents-memory'
[arvados.git] / apps / workbench / app / models / container_work_unit.rb
index ed82f18036c1025bffb16e5267701045039bb167..84fc1f8f0978e16a86bd34fde8d07a6d2d9cd7c1 100644 (file)
@@ -53,6 +53,10 @@ class ContainerWorkUnit < ProxyWorkUnit
     get(:container_uuid)
   end
 
+  def requesting_container_uuid
+    get(:requesting_container_uuid)
+  end
+
   def priority
     @proxied.priority
   end
@@ -81,8 +85,11 @@ class ContainerWorkUnit < ProxyWorkUnit
   def state_label
     ec = exit_code
     return "Failed" if (ec && ec != 0)
+
     state = get_combined(:state)
-    return "Ready" if ((priority == 0) and (["Queued", "Locked"].include?(state)))
+
+    return "Queued" if state == "Locked"
+    return "Cancelled" if ((priority == 0) and (state == "Queued"))
     state
   end
 
@@ -163,6 +170,13 @@ class ContainerWorkUnit < ProxyWorkUnit
 
   protected
   def get_combined key
-    get(key, @container) || get(key, @proxied)
+    from_container = get(key, @container)
+    from_proxied = get(key, @proxied)
+
+    if from_container.is_a? Hash or from_container.is_a? Array
+      if from_container.any? then from_container else from_proxied end
+    else
+      from_container || from_proxied
+    end
   end
 end