[ARVADOS] updated: 2.1.0-233-g2879be603

Git user git at public.arvados.org
Mon Jan 4 19:48:37 UTC 2021


Summary of changes:
 services/api/app/models/container_request.rb                      | 8 +++++++-
 .../functional/arvados/v1/container_requests_controller_test.rb   | 2 +-
 services/api/test/unit/container_request_test.rb                  | 6 +++---
 3 files changed, 11 insertions(+), 5 deletions(-)

       via  2879be603902fca7d5e796b78ab2b2f9f27bd309 (commit)
      from  af2ce3cfafb4d4aa3d215b812f22e8db8ff4a9b4 (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 2879be603902fca7d5e796b78ab2b2f9f27bd309
Author: Nico Cesar <nico at nicocesar.com>
Date:   Mon Jan 4 14:47:35 2021 -0500

    Preemptible related tests fixed to accomodate new defaults
    
    Arvados-DCO-1.1-Signed-off-by: Nico Cesar <nico at curii.com>

diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index fc1961127..687aa5368 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -108,7 +108,7 @@ class ContainerRequest < ArvadosModel
   AttrsSchedulingParametersDefaults = {
     "max_run_time"=>0,
     "partitions"=>[],
-    "preemptible"=>false
+    ## "preemptible"=> Rails.configuration.Containers.UsePreemptibleInstances  ##  we have to read this on the fly to pass the tests
   }
 
   def self.limit_index_columns_read
@@ -492,6 +492,12 @@ class ContainerRequest < ArvadosModel
         attributes["scheduling_parameters"][key] = value
       end
     end
+
+    ## We treat scheduling parameters["preemtible"] differently
+    if attributes["scheduling_parameters"] && !attributes["scheduling_parameters"].key?("preemptible")
+      attributes["scheduling_parameters"]["preemptible"] = Rails.configuration.Containers.UsePreemptibleInstances
+    end
+
     self.clear_attribute_changes(["runtime_constraints", "scheduling_parameters"])
 
     super
diff --git a/services/api/test/functional/arvados/v1/container_requests_controller_test.rb b/services/api/test/functional/arvados/v1/container_requests_controller_test.rb
index a5e946e19..6f0a41158 100644
--- a/services/api/test/functional/arvados/v1/container_requests_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/container_requests_controller_test.rb
@@ -77,7 +77,7 @@ class Arvados::V1::ContainerRequestsControllerTest < ActionController::TestCase
           'keep_cache_ram' => 0,
         },
         scheduling_parameters: {
-          "preemptible"=>nil
+          "preemptible"=>false
         }
       },
     }
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index f841de6c3..aed3d9342 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -1011,9 +1011,9 @@ class ContainerRequestTest < ActiveSupport::TestCase
 
   [
     [true, 'zzzzz-dz642-runningcontainr', true],
-    [true, nil, nil],
-    [false, 'zzzzz-dz642-runningcontainr', nil],
-    [false, nil, nil],
+    [true, nil, true],
+    [false, 'zzzzz-dz642-runningcontainr', false],
+    [false, nil, false],
   ].each do |preemptible_conf, requesting_c, schedule_preemptible|
     test "having Rails.configuration.Containers.UsePreemptibleInstances=#{preemptible_conf}, #{requesting_c.nil? ? 'non-':''}child CR should #{schedule_preemptible ? '':'not'} ask for preemptible instance by default" do
       common_attrs = {cwd: "test",

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list