20978: Add sort-by-scratch fallback.
authorTom Clegg <tom@curii.com>
Thu, 2 Nov 2023 19:37:16 +0000 (15:37 -0400)
committerTom Clegg <tom@curii.com>
Thu, 2 Nov 2023 19:37:16 +0000 (15:37 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/dispatchcloud/node_size.go

index 0a5a79bc7044e03b9e672761e931f1779761bd67..802bc65c28ca3b96c05ae269b467f7698fac55db 100644 (file)
@@ -178,9 +178,9 @@ func ChooseInstanceType(cc *arvados.Cluster, ctr *arvados.Container) ([]arvados.
                        // if same price and RAM, prefer more VCPUs
                        return types[i].VCPUs > types[j].VCPUs
                }
-               if types[i].VCPUs != types[j].VCPUs {
-                       // if same price and RAM, prefer more VCPUs
-                       return types[i].VCPUs > types[j].VCPUs
+               if types[i].Scratch != types[j].Scratch {
+                       // if same price and RAM and VCPUs, prefer more scratch
+                       return types[i].Scratch > types[j].Scratch
                }
                // no preference, just sort the same way each time
                return types[i].Name < types[j].Name