[ARVADOS] updated: 2.1.0-2406-g6231459c9

Git user git at public.arvados.org
Tue May 10 15:27:09 UTC 2022


Summary of changes:
 services/api/app/models/container_request.rb     | 15 ++++++++------
 services/api/test/unit/container_request_test.rb | 25 ++++++++++++++++++++++--
 2 files changed, 32 insertions(+), 8 deletions(-)

       via  6231459c9b63f82b4a979af12c771c02441a7339 (commit)
      from  76ccf3c632bb43c0c26a359d0a814f672e730662 (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 6231459c9b63f82b4a979af12c771c02441a7339
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Tue May 10 11:26:44 2022 -0400

    17004: Allow output_properties to override the default metadata
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index 605b376cf..911603590 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -237,17 +237,20 @@ class ContainerRequest < ArvadosModel
       end
 
       merged_properties = {}
-      if out_type == "output"
-        merged_properties.update(container.output_properties)
-        merged_properties.update(self.output_properties)
-      end
+      merged_properties['container_request'] = uuid
 
       if out_type == 'output' and !requesting_container_uuid.nil?
-          merged_properties['type'] = 'intermediate'
+        # output of a child process, give it "intermediate" type by
+        # default.
+        merged_properties['type'] = 'intermediate'
       else
         merged_properties['type'] = out_type
       end
-      merged_properties['container_request'] = uuid
+
+      if out_type == "output"
+        merged_properties.update(container.output_properties)
+        merged_properties.update(self.output_properties)
+      end
 
       coll.assign_attributes(
         portable_data_hash: Digest::MD5.hexdigest(manifest) + '+' + manifest.bytesize.to_s,
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index 5a75fb5fa..e5c008518 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -469,13 +469,34 @@ class ContainerRequestTest < ActiveSupport::TestCase
   ].each do |token, expected, expected_priority|
     test "create as #{token} and expect requesting_container_uuid to be #{expected}" do
       set_user_from_auth token
-      cr = ContainerRequest.create(container_image: "img", output_path: "/tmp", command: ["echo", "foo"])
+      cr = create_minimal_req!
       assert_not_nil cr.uuid, 'uuid should be set for newly created container_request'
       assert_equal expected, cr.requesting_container_uuid
       assert_equal expected_priority, cr.priority
     end
   end
 
+  [
+    ['running_container_auth', 'zzzzz-dz642-runningcontainr', 501],
+  ].each do |token, expected, expected_priority|
+    test "create as #{token} with requesting_container_uuid set and expect output to be intermediate" do
+      set_user_from_auth token
+      cr = create_minimal_req!
+      assert_not_nil cr.uuid, 'uuid should be set for newly created container_request'
+      assert_equal expected, cr.requesting_container_uuid
+      assert_equal expected_priority, cr.priority
+
+      cr.state = ContainerRequest::Committed
+      cr.save!
+
+      run_container(cr)
+      cr.reload
+      output = Collection.find_by_uuid(cr.output_uuid)
+      props = {"type": "intermediate", "container_request": cr.uuid}
+      assert_equal props.symbolize_keys, output.properties.symbolize_keys
+    end
+  end
+
   test "create as container_runtime_token and expect requesting_container_uuid to be zzzzz-dz642-20isqbkl8xwnsao" do
     set_user_from_auth :container_runtime_token
     Thread.current[:token] = "#{Thread.current[:token]}/zzzzz-dz642-20isqbkl8xwnsao"
@@ -1455,7 +1476,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
     [{},               {"a1": "b1"}, {"type": "output", "a1": "b1"}],
     [{"a1": "b1"},     {"a1": "c1"}, {"type": "output", "a1": "b1"}],
     [{"a1": "b1"},     {"a2": "c2"}, {"type": "output", "a1": "b1", "a2": "c2"}],
-    [{"type": "blah"}, {},           {"type": "output"}],
+    [{"type": "blah"}, {},           {"type": "blah"}],
   ].each do |cr_prop, container_prop, expect_prop|
     test "setting output_properties #{cr_prop} #{container_prop} on current container" do
       act_as_user users(:active) do

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list