12199: Derate advertised node sizes by 5%.
authorTom Clegg <tclegg@veritasgenetics.com>
Mon, 29 Jan 2018 16:48:43 +0000 (11:48 -0500)
committerTom Clegg <tclegg@veritasgenetics.com>
Mon, 29 Jan 2018 18:05:58 +0000 (13:05 -0500)
This matches nodemanager's default behavior. It aims to account for
the difference between advertised and actual memory capacity, as well
as making some room for system processes on the host.

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go
services/dispatchcloud/node_size.go

index 583e0d80c938179a3db45aa5a6f72ed3d045b4a0..73d9c162e264f18372920fa4406b4f9fa88a8d26 100644 (file)
@@ -387,8 +387,9 @@ func (s *StubbedSuite) TestSbatchInstanceTypeConstraint(c *C) {
                                {Name: "a1.tiny", Price: 0.02, RAM: 128000000, VCPUs: 1},
                                {Name: "a1.small", Price: 0.04, RAM: 256000000, VCPUs: 2},
                                {Name: "a1.medium", Price: 0.08, RAM: 512000000, VCPUs: 4},
+                               {Name: "a1.large", Price: 0.16, RAM: 1024000000, VCPUs: 8},
                        },
-                       sbatchArgs: []string{"--constraint=instancetype=a1.small"},
+                       sbatchArgs: []string{"--constraint=instancetype=a1.medium"},
                },
                // No node types configured => no slurm constraint
                {
index 29832dac7702c4d51d25edf903c9abed319f9df6..eeb3b819e5e688f2ad4a2c2cc593f7425da17f32 100644 (file)
@@ -18,6 +18,7 @@ import (
 var (
        ErrConstraintsNotSatisfiable  = errors.New("constraints not satisfiable by any configured instance type")
        ErrInstanceTypesNotConfigured = errors.New("site configuration does not list any instance types")
+       discountConfiguredRAMPercent  = 5
 )
 
 // ChooseInstanceType returns the cheapest available
@@ -26,6 +27,8 @@ func ChooseInstanceType(cc *arvados.Cluster, ctr *arvados.Container) (best arvad
        needVCPUs := ctr.RuntimeConstraints.VCPUs
        needRAM := ctr.RuntimeConstraints.RAM + ctr.RuntimeConstraints.KeepCacheRAM
 
+       needRAM = needRAM * 100 / int64(100-discountConfiguredRAMPercent)
+
        if len(cc.InstanceTypes) == 0 {
                err = ErrInstanceTypesNotConfigured
                return