[ARVADOS] updated: 8ebd52397bcf105a771895c1ceb33b7ab6880887

git at public.curoverse.com git at public.curoverse.com
Fri Dec 11 10:24:11 EST 2015


Summary of changes:
 services/api/app/models/container.rb         | 5 ++---
 services/api/app/models/container_request.rb | 6 ++++++
 2 files changed, 8 insertions(+), 3 deletions(-)

       via  8ebd52397bcf105a771895c1ceb33b7ab6880887 (commit)
      from  8aeac20eed5c6eb2cc9f41ada60632265cbdd556 (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 8ebd52397bcf105a771895c1ceb33b7ab6880887
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Dec 11 10:24:06 2015 -0500

    6429: Callback calls container_completed! instead of just setting state to final.

diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb
index d777c0c..48f4916 100644
--- a/services/api/app/models/container.rb
+++ b/services/api/app/models/container.rb
@@ -152,11 +152,10 @@ class Container < ArvadosModel
     # that are associated with this container.
     if self.state_changed? and [Complete, Cancelled].include? self.state
       act_as_system_user do
-        # Try to close container requests associated with this container
+        # Notify container requests associated with this container
         ContainerRequest.where(container_uuid: uuid,
                                :state => ContainerRequest::Committed).each do |cr|
-          cr.state = ContainerRequest::Final
-          cr.save
+          cr.container_completed!
         end
 
         # Try to cancel any outstanding container requests made by this container.
diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index acadaa7..acb751c 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -62,6 +62,12 @@ class ContainerRequest < ArvadosModel
     %w(modified_by_client_uuid container_uuid requesting_container_uuid)
   end
 
+  def container_completed!
+    # may implement retry logic here in the future.
+    self.state = ContainerRequest::Final
+    self.save!
+  end
+
   protected
 
   def fill_field_defaults

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list