17395: Update documentation. Add an additional test.
authorPeter Amstutz <peter.amstutz@curii.com>
Wed, 30 Jun 2021 14:30:38 +0000 (10:30 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Wed, 30 Jun 2021 14:30:38 +0000 (10:30 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

doc/api/methods/container_requests.html.textile.liquid
doc/api/methods/containers.html.textile.liquid
services/api/test/unit/container_request_test.rb

index b24a24e0674b9a6f01e7463072e8ccd18ed15213..0aa96c3c38901c33af9c6ccbe6a983a518a470d5 100644 (file)
@@ -60,6 +60,7 @@ table(table table-bordered table-condensed).
 |runtime_token|string|A v2 token to be passed into the container itself, used to access Keep-backed mounts, etc.  |Not returned in API responses.  Reset to null when state is "Complete" or "Cancelled".|
 |runtime_user_uuid|string|The user permission that will be granted to this container.||
 |runtime_auth_scopes|array of string|The scopes associated with the auth token used to run this container.||
+|output_storage_classes|array of strings|The storage classes that will be used for the log and output collections of this container request|default is ["default"]|
 
 h2(#priority). Priority
 
index 096a1fcaa9b628e6d5907ac33e8c6625f1114fd7..7da05cbd0b6812b68a136212a50b060fe1920476 100644 (file)
@@ -59,6 +59,7 @@ Generally this will contain additional keys that are not present in any correspo
 |runtime_token|string|A v2 token to be passed into the container itself, used to access Keep-backed mounts, etc.|Not returned in API responses.  Reset to null when state is "Complete" or "Cancelled".|
 |gateway_address|string|Address (host:port) of gateway server.|Internal use only.|
 |interactive_session_started|boolean|Indicates whether @arvados-client shell@ has been used to run commands in the container, which may have altered the container's behavior and output.||
+|output_storage_classes|array of strings|The storage classes that will be used for the log and output collections of this container||
 
 h2(#container_states). Container states
 
index f28e38faae1cc4b52365e1375d2f4f93dd03c8cb..7686e1a140618588fc15dcd8f71cb733d5af04c5 100644 (file)
@@ -1313,6 +1313,46 @@ class ContainerRequestTest < ActiveSupport::TestCase
       cr.reload
       output = Collection.find_by_uuid(cr.output_uuid)
       assert_equal ["foo_storage_class", "bar_storage_class"], output.storage_classes_desired
+      log = Collection.find_by_uuid(cr.log_uuid)
+      assert_equal ["foo_storage_class", "bar_storage_class"], log.storage_classes_desired
     end
   end
+
+  test "reusing container with different container_request.output_storage_classes" do
+    common_attrs = {cwd: "test",
+                    priority: 1,
+                    command: ["echo", "hello"],
+                    output_path: "test",
+                    runtime_constraints: {"vcpus" => 4,
+                                          "ram" => 12000000000},
+                    mounts: {"test" => {"kind" => "json"}},
+                    environment: {"var" => "value1"},
+                    output_storage_classes: ["foo_storage_class"]}
+    set_user_from_auth :active
+    cr1 = create_minimal_req!(common_attrs.merge({state: ContainerRequest::Committed}))
+    cont1 = run_container(cr1)
+    cr1.reload
+
+    output1 = Collection.find_by_uuid(cr1.output_uuid)
+
+    # Testing with use_existing default value
+    cr2 = create_minimal_req!(common_attrs.merge({state: ContainerRequest::Uncommitted,
+                                                  output_storage_classes: ["bar_storage_class"]}))
+
+    assert_not_nil cr1.container_uuid
+    assert_nil cr2.container_uuid
+
+    # Update cr2 to commited state, check for reuse, then run it
+    cr2.update_attributes!({state: ContainerRequest::Committed})
+    assert_equal cr1.container_uuid, cr2.container_uuid
+
+    cr2.reload
+    output2 = Collection.find_by_uuid(cr2.output_uuid)
+
+    # the original CR output has the original storage class,
+    # but the second CR output has the new storage class.
+    assert_equal ["foo_storage_class"], cont1.output_storage_classes
+    assert_equal ["foo_storage_class"], output1.storage_classes_desired
+    assert_equal ["bar_storage_class"], output2.storage_classes_desired
+  end
 end