[ARVADOS] updated: b781e22ea6be76ece696c80de6b59ae223f3a06f

git at public.curoverse.com git at public.curoverse.com
Wed Dec 9 16:02:59 EST 2015


Summary of changes:
 services/api/app/models/container.rb | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

       via  b781e22ea6be76ece696c80de6b59ae223f3a06f (commit)
      from  d4939c581f629a19220bc5b469fed98462b2b7eb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit b781e22ea6be76ece696c80de6b59ae223f3a06f
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Wed Dec 9 16:02:53 2015 -0500

    6429: Don't update priority if the container is already in Complete or Cancelled state.

diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb
index 79c9868..903f392 100644
--- a/services/api/app/models/container.rb
+++ b/services/api/app/models/container.rb
@@ -57,16 +57,18 @@ class Container < ArvadosModel
   end
 
   def update_priority!
-    # Update the priority of this container to the maximum priority of any of
-    # its committed container requests and save the record.
-    max = 0
-    ContainerRequest.where(container_uuid: uuid).each do |cr|
-      if cr.state == ContainerRequest::Committed and cr.priority > max
-        max = cr.priority
+    if [Queued, Running].include? self.state
+      # Update the priority of this container to the maximum priority of any of
+      # its committed container requests and save the record.
+      max = 0
+      ContainerRequest.where(container_uuid: uuid).each do |cr|
+        if cr.state == ContainerRequest::Committed and cr.priority > max
+          max = cr.priority
+        end
       end
+      self.priority = max
+      self.save!
     end
-    self.priority = max
-    self.save!
   end
 
   protected

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list