[ARVADOS] created: 1.1.2-59-g56461e4

Git user git at public.curoverse.com
Mon Jan 15 11:22:12 EST 2018


        at  56461e4a9d3d8b440397403a0e1137913e9145ba (commit)


commit 56461e4a9d3d8b440397403a0e1137913e9145ba
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Mon Jan 15 11:21:25 2018 -0500

    12916: Do not set output_uuid on request when container fails.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/doc/api/methods/container_requests.html.textile.liquid b/doc/api/methods/container_requests.html.textile.liquid
index 1c2550f..b5502ba 100644
--- a/doc/api/methods/container_requests.html.textile.liquid
+++ b/doc/api/methods/container_requests.html.textile.liquid
@@ -55,7 +55,7 @@ table(table table-bordered table-condensed).
 |use_existing|boolean|If possible, use an existing (non-failed) container to satisfy the request instead of creating a new one.|Default is true|
 |log_uuid|string|Log collection containing log messages provided by the scheduler and crunch processes.|Null if the container has not yet completed.|
 |output_uuid|string|Output collection created when the container finished successfully.|Null if the container has failed or not yet completed.|
-|filters|string|Additional constraints for satisfying the container_request, given in the same form as the filters parameter accepted by the container_requests.list API.|
+|filters|string|Additional constraints for satisfying the container_request, given in the same form as the filters parameter accepted by the container_requests.list API.||
 
 h2(#priority). Priority
 
diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index 3596bf3..bf90324 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -134,7 +134,9 @@ class ContainerRequest < ArvadosModel
                             })
       coll.save_with_unique_name!
       if out_type == 'output'
-        out_coll = coll.uuid
+        if c.state == Container::Complete && c.exit_code == 0
+          out_coll = coll.uuid
+        end
       else
         log_coll = coll.uuid
       end
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index 0edc0f4..7dacf35 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -245,6 +245,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
     log_pdh = 'fa7aeb5140e2848d39b416daeef4ffc5+45'
     act_as_system_user do
       c.update_attributes!(state: Container::Complete,
+                           exit_code: 0,
                            output: output_pdh,
                            log: log_pdh)
     end
@@ -613,6 +614,21 @@ class ContainerRequestTest < ActiveSupport::TestCase
     assert_not_equal cr2.container_uuid, cr.container_uuid
   end
 
+  [
+    ['failed', {exit_code: 1, end_state: Container::Complete}],
+    ['cancelled', {exit_code: nil, end_state: Container::Cancelled}],
+  ].each do |label, fate|
+    test "output_uuid not set after container #{label}" do
+      set_user_from_auth :active
+      cr = create_minimal_req!(priority: 1,
+                               state: ContainerRequest::Committed)
+      run_container(cr, exit_code: fate[:exit_code], end_state: fate[:end_state])
+      cr.reload
+      assert_not_nil cr.log_uuid
+      assert_nil cr.output_uuid
+    end
+  end
+
   test "Output collection name setting using output_name with name collision resolution" do
     set_user_from_auth :active
     output_name = 'unimaginative name'
@@ -673,13 +689,13 @@ class ContainerRequestTest < ActiveSupport::TestCase
     assert_in_delta(delete, now + year, 10)
   end
 
-  def run_container(cr)
+  def run_container(cr, end_state: Container::Complete, exit_code: 0)
     act_as_system_user do
       c = Container.find_by_uuid(cr.container_uuid)
       c.update_attributes!(state: Container::Locked)
       c.update_attributes!(state: Container::Running)
-      c.update_attributes!(state: Container::Complete,
-                           exit_code: 0,
+      c.update_attributes!(state: end_state,
+                           exit_code: exit_code,
                            output: '1f4b0bc7583c2a7f9102c395f4ffc5e3+45',
                            log: 'fa7aeb5140e2848d39b416daeef4ffc5+45')
       c

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list