[arvados] updated: 2.1.0-2969-g2b6f6f617

git repository hosting git at public.arvados.org
Tue Oct 25 20:12:58 UTC 2022


Summary of changes:
 sdk/go/arvados/config.go                         | 1 +
 services/api/app/models/arvados_model.rb         | 6 +++++-
 services/api/app/models/container.rb             | 9 +++++++++
 services/api/test/fixtures/containers.yml        | 5 +++++
 services/api/test/unit/container_request_test.rb | 5 ++++-
 services/api/test/unit/container_test.rb         | 7 ++++---
 6 files changed, 28 insertions(+), 5 deletions(-)

       via  2b6f6f61757ad01f7d8baf63b190c1e1cd42db41 (commit)
      from  c10bd6ad576a5dd1f7ededa9df6361003cd5ebd1 (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 2b6f6f61757ad01f7d8baf63b190c1e1cd42db41
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Tue Oct 25 16:12:44 2022 -0400

    18842: Fix tests
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/sdk/go/arvados/config.go b/sdk/go/arvados/config.go
index 3c1ef4826..6360b7b31 100644
--- a/sdk/go/arvados/config.go
+++ b/sdk/go/arvados/config.go
@@ -446,6 +446,7 @@ type ContainersConfig struct {
 	CrunchRunCommand              string
 	CrunchRunArgumentsList        []string
 	DefaultKeepCacheRAM           ByteSize
+	DefaultKeepCacheDisk          ByteSize
 	DispatchPrivateKey            string
 	LogReuseDecisions             bool
 	MaxComputeVMs                 int
diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index 7143378d2..fe4f5bcec 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -951,6 +951,10 @@ class ArvadosModel < ApplicationRecord
   # value in the database to an implicit zero/false value in an update
   # request.
   def fill_container_defaults
+    # Make sure this is correctly sorted by key, because we merge in
+    # whatever is in the database on top of it, this will be the order
+    # that gets used downstream rather than the order the keys appear
+    # in the database.
     self.runtime_constraints = {
       'API' => false,
       'cuda' => {
@@ -958,8 +962,8 @@ class ArvadosModel < ApplicationRecord
         'driver_version' => '',
         'hardware_capability' => '',
       },
-      'keep_cache_ram' => 0,
       'keep_cache_disk' => 0,
+      'keep_cache_ram' => 0,
       'ram' => 0,
       'vcpus' => 0,
     }.merge(attributes['runtime_constraints'] || {})
diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb
index 3334fdcac..4b02ad52e 100644
--- a/services/api/app/models/container.rb
+++ b/services/api/app/models/container.rb
@@ -310,6 +310,15 @@ class Container < ArvadosModel
       # records that don't have a 'cuda' section in runtime_constraints
       resolved_runtime_constraints << resolved_runtime_constraints[0].except('cuda')
     end
+    if resolved_runtime_constraints[0]['keep_cache_disk'] == 0
+      # If no disk cache requested, extend search to include older container
+      # records that don't have a 'keep_cache_disk' field in runtime_constraints
+      if resolved_runtime_constraints.length == 2
+        # exclude the one that also excludes CUDA
+        resolved_runtime_constraints << resolved_runtime_constraints[1].except('keep_cache_disk')
+      end
+      resolved_runtime_constraints << resolved_runtime_constraints[0].except('keep_cache_disk')
+    end
 
     candidates = candidates.where_serialized(:runtime_constraints, resolved_runtime_constraints, md5: true, multivalue: true)
     log_reuse_info(candidates) { "after filtering on runtime_constraints #{attrs[:runtime_constraints].inspect}" }
diff --git a/services/api/test/fixtures/containers.yml b/services/api/test/fixtures/containers.yml
index a61fb0717..73b17280b 100644
--- a/services/api/test/fixtures/containers.yml
+++ b/services/api/test/fixtures/containers.yml
@@ -170,6 +170,7 @@ diagnostics_completed_requester:
            ]
   runtime_constraints:
     API: true
+    keep_cache_disk: 0
     keep_cache_ram: 268435456
     ram: 1342177280
     vcpus: 1
@@ -195,6 +196,7 @@ diagnostics_completed_hasher1:
            ]
   runtime_constraints:
     API: true
+    keep_cache_disk: 0
     keep_cache_ram: 268435456
     ram: 268435456
     vcpus: 1
@@ -220,6 +222,7 @@ diagnostics_completed_hasher2:
            ]
   runtime_constraints:
     API: true
+    keep_cache_disk: 0
     keep_cache_ram: 268435456
     ram: 268435456
     vcpus: 2
@@ -245,6 +248,7 @@ diagnostics_completed_hasher3:
            ]
   runtime_constraints:
     API: true
+    keep_cache_disk: 0
     keep_cache_ram: 268435456
     ram: 268435456
     vcpus: 1
@@ -281,6 +285,7 @@ diagnostics_completed_requester2:
            ]
   runtime_constraints:
     API: true
+    keep_cache_disk: 0
     keep_cache_ram: 268435456
     ram: 1342177280
     vcpus: 1
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index e6db41217..efc61eee8 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -177,6 +177,9 @@ class ContainerRequestTest < ActiveSupport::TestCase
 
     assert ({"vcpus" => 2, "ram" => 30}.to_a - cr.runtime_constraints.to_a).empty?
 
+    assert_equal 0, Rails.configuration.Containers.DefaultKeepCacheRAM
+    assert_equal 8589934592, Rails.configuration.Containers.DefaultKeepCacheDisk
+
     assert_not_nil cr.container_uuid
     c = Container.find_by_uuid cr.container_uuid
     assert_not_nil c
@@ -186,7 +189,7 @@ class ContainerRequestTest < ActiveSupport::TestCase
     assert_equal({}, c.environment)
     assert_equal({"/out" => {"kind"=>"tmp", "capacity"=>1000000}}, c.mounts)
     assert_equal "/out", c.output_path
-    assert ({"keep_cache_ram"=>268435456, "vcpus" => 2, "ram" => 30}.to_a - c.runtime_constraints.to_a).empty?
+    assert ({"keep_cache_disk"=>8589934592, "keep_cache_ram"=>0, "vcpus" => 2, "ram" => 30}.to_a - c.runtime_constraints.to_a).empty?
     assert_operator 0, :<, c.priority
 
     assert_raises(ActiveRecord::RecordInvalid) do
diff --git a/services/api/test/unit/container_test.rb b/services/api/test/unit/container_test.rb
index a4c0ce179..f804aca2d 100644
--- a/services/api/test/unit/container_test.rb
+++ b/services/api/test/unit/container_test.rb
@@ -24,6 +24,7 @@ class ContainerTest < ActiveSupport::TestCase
     output_path: "test",
     runtime_constraints: {
       "API" => false,
+      "keep_cache_disk" => 0,
       "keep_cache_ram" => 0,
       "ram" => 12000000000,
       "vcpus" => 4
@@ -229,7 +230,7 @@ class ContainerTest < ActiveSupport::TestCase
     set_user_from_auth :active
     env = {"C" => "3", "B" => "2", "A" => "1"}
     m = {"F" => {"kind" => "3"}, "E" => {"kind" => "2"}, "D" => {"kind" => "1"}}
-    rc = {"vcpus" => 1, "ram" => 1, "keep_cache_ram" => 1, "API" => true, "cuda" => {"device_count":0, "driver_version": "", "hardware_capability": ""}}
+    rc = {"vcpus" => 1, "ram" => 1, "keep_cache_ram" => 1, "keep_cache_disk" => 0, "API" => true, "cuda" => {"device_count":0, "driver_version": "", "hardware_capability": ""}}
     c, _ = minimal_new(environment: env, mounts: m, runtime_constraints: rc)
     c.reload
     assert_equal Container.deep_sort_hash(env).to_json, c.environment.to_json
@@ -594,14 +595,14 @@ class ContainerTest < ActiveSupport::TestCase
     set_user_from_auth :active
     # No cuda
     no_cuda_attrs = REUSABLE_COMMON_ATTRS.merge({use_existing:false, priority:1, environment:{"var" => "queued"},
-                                                runtime_constraints: {"vcpus" => 1, "ram" => 1, "keep_cache_ram"=>268435456, "API" => false,
+                                                runtime_constraints: {"vcpus" => 1, "ram" => 1, "keep_cache_disk"=>0, "keep_cache_ram"=>268435456, "API" => false,
                                                                       "cuda" => {"device_count":0, "driver_version": "", "hardware_capability": ""}},})
     c1, _ = minimal_new(no_cuda_attrs)
     assert_equal Container::Queued, c1.state
 
     # has cuda
     cuda_attrs = REUSABLE_COMMON_ATTRS.merge({use_existing:false, priority:1, environment:{"var" => "queued"},
-                                                runtime_constraints: {"vcpus" => 1, "ram" => 1, "keep_cache_ram"=>268435456, "API" => false,
+                                                runtime_constraints: {"vcpus" => 1, "ram" => 1, "keep_cache_disk"=>0, "keep_cache_ram"=>268435456, "API" => false,
                                                                       "cuda" => {"device_count":1, "driver_version": "11.0", "hardware_capability": "9.0"}},})
     c2, _ = minimal_new(cuda_attrs)
     assert_equal Container::Queued, c2.state

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list