[ARVADOS] updated: 47e42f1129363c2565e69c36ff26ce9c42731fb8

Git user git at public.curoverse.com
Fri Oct 7 14:32:24 EDT 2016


Summary of changes:
 services/api/app/models/container.rb               | 27 +++++++++++++
 services/api/app/models/container_request.rb       | 12 +++++-
 services/api/config/application.default.yml        |  7 ++++
 .../migrate/20160926194129_add_container_count.rb  |  9 +++++
 services/api/db/structure.sql                      |  7 +++-
 services/api/test/unit/container_request_test.rb   | 44 ++++++++++++++++++++--
 6 files changed, 100 insertions(+), 6 deletions(-)
 create mode 100644 services/api/db/migrate/20160926194129_add_container_count.rb

       via  47e42f1129363c2565e69c36ff26ce9c42731fb8 (commit)
       via  8317b6e41e86f3e5c988906e0a9965479acf7e51 (commit)
       via  929e817fc1c91e1d9a0afcfcab93fe07304d9be5 (commit)
       via  068b2c9dbe1e467119680cbab61c62a03ad4fafd (commit)
       via  49987769d924c1bc77cbdc9e9b182c3e2cc09b2d (commit)
       via  3fb81a4db7abbaaa67b7a18d1c4a5ce82bc232dc (commit)
      from  78995d3bf5b9e160de50318bc83744dda92e4211 (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 47e42f1129363c2565e69c36ff26ce9c42731fb8
Merge: 78995d3 8317b6e
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Oct 7 14:32:15 2016 -0400

    Merge branch '8018-container-retry' closes #8018

diff --cc services/api/app/models/container.rb
index a60ea42,29af223..43c5b30
--- a/services/api/app/models/container.rb
+++ b/services/api/app/models/container.rb
@@@ -307,9 -282,36 +307,36 @@@ class Container < ArvadosMode
      # that are associated with this container.
      if self.state_changed? and [Complete, Cancelled].include? self.state
        act_as_system_user do
+ 
+         if self.state == Cancelled
+           retryable_requests = ContainerRequest.where("priority > 0 and state = 'Committed' and container_count < container_count_max")
+         else
+           retryable_requests = []
+         end
+ 
+         if retryable_requests.any?
+           c_attrs = {
+             command: self.command,
+             cwd: self.cwd,
+             environment: self.environment,
+             output_path: self.output_path,
+             container_image: self.container_image,
+             mounts: self.mounts,
+             runtime_constraints: self.runtime_constraints
+           }
+           c = Container.create! c_attrs
+           retryable_requests.each do |cr|
+             cr.with_lock do
+               # Use row locking because this increments container_count
+               cr.container_uuid = c.uuid
+               cr.save
+             end
+           end
+         end
+ 
          # Notify container requests associated with this container
          ContainerRequest.where(container_uuid: uuid,
 -                               :state => ContainerRequest::Committed).each do |cr|
 +                               state: ContainerRequest::Committed).each do |cr|
            cr.container_completed!
          end
  

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list