17340: arvados-dispatch-cloud should take the Containers.ReserveExtraRAM
authorWard Vandewege <ward@curii.com>
Thu, 4 Feb 2021 19:07:10 +0000 (14:07 -0500)
committerWard Vandewege <ward@curii.com>
Thu, 4 Feb 2021 19:09:41 +0000 (14:09 -0500)
       configuration parameter into account when choosing a node size.

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

lib/dispatchcloud/node_size.go
lib/dispatchcloud/node_size_test.go

index fd04860861a14f9ff6b526ac6a562de02f0c74e4..7e8ce0bf4206834c80a176a7411ea614c2e1e3f7 100644 (file)
@@ -96,6 +96,7 @@ func ChooseInstanceType(cc *arvados.Cluster, ctr *arvados.Container) (best arvad
        needVCPUs := ctr.RuntimeConstraints.VCPUs
 
        needRAM := ctr.RuntimeConstraints.RAM + ctr.RuntimeConstraints.KeepCacheRAM
+       needRAM += int64(cc.Containers.ReserveExtraRAM)
        needRAM = (needRAM * 100) / int64(100-discountConfiguredRAMPercent)
 
        ok := false
index ea98efe1d2b175c70eb7394d106af45e491e41e6..abd292cbaf1278c7ca147e7da7352d74d0ad39d0 100644 (file)
@@ -73,8 +73,14 @@ func (*NodeSizeSuite) TestChoose(c *check.C) {
                        "best":   {Price: 3.3, RAM: 4000000000, VCPUs: 4, Scratch: 2 * GiB, Name: "best"},
                        "costly": {Price: 4.4, RAM: 4000000000, VCPUs: 8, Scratch: 2 * GiB, Name: "costly"},
                },
+               {
+                       "small":  {Price: 1.1, RAM: 1000000000, VCPUs: 2, Scratch: GiB, Name: "small"},
+                       "nearly": {Price: 2.2, RAM: 1200000000, VCPUs: 4, Scratch: 2 * GiB, Name: "nearly"},
+                       "best":   {Price: 3.3, RAM: 4000000000, VCPUs: 4, Scratch: 2 * GiB, Name: "best"},
+                       "costly": {Price: 4.4, RAM: 4000000000, VCPUs: 8, Scratch: 2 * GiB, Name: "costly"},
+               },
        } {
-               best, err := ChooseInstanceType(&arvados.Cluster{InstanceTypes: menu}, &arvados.Container{
+               best, err := ChooseInstanceType(&arvados.Cluster{InstanceTypes: menu, Containers: arvados.ContainersConfig{ReserveExtraRAM: 268435456}}, &arvados.Container{
                        Mounts: map[string]arvados.Mount{
                                "/tmp": {Kind: "tmp", Capacity: 2 * int64(GiB)},
                        },