19320: Disable spot price checks if configured update interval <= 0.
authorTom Clegg <tom@curii.com>
Tue, 24 Jan 2023 22:40:34 +0000 (17:40 -0500)
committerTom Clegg <tom@curii.com>
Tue, 24 Jan 2023 22:47:31 +0000 (17:47 -0500)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/cloud/ec2/ec2.go
lib/cloud/ec2/ec2_test.go
lib/config/config.default.yml

index 93c308bcb13f328185aaf4aa6e0421bfd4fe62f8..7c7c48b9b3dfb28ddec41a3faf3ec24f58bbef66 100644 (file)
@@ -246,10 +246,6 @@ func (instanceSet *ec2InstanceSet) Create(
                }
        }
 
-       if instanceSet.ec2config.SpotPriceUpdateInterval <= 0 {
-               instanceSet.ec2config.SpotPriceUpdateInterval = arvados.Duration(24 * time.Hour)
-       }
-
        rsv, err := instanceSet.client.RunInstances(&rii)
        err = wrapError(err, &instanceSet.throttleDelayCreate)
        if err != nil {
@@ -296,7 +292,7 @@ func (instanceSet *ec2InstanceSet) Instances(tags cloud.InstanceTags) (instances
                }
                dii.NextToken = dio.NextToken
        }
-       if needAZs {
+       if needAZs && instanceSet.ec2config.SpotPriceUpdateInterval > 0 {
                az := map[string]string{}
                err := instanceSet.client.DescribeInstanceStatusPages(&ec2.DescribeInstanceStatusInput{
                        IncludeAllInstances: aws.Bool(true),
index 79ee0d04eb6a991c92289d3f85cdcac45892c9ec..2b4b19850476c439c17e484c3c6863804e0311c5 100644 (file)
@@ -191,7 +191,9 @@ func GetInstanceSet(c *check.C) (*ec2InstanceSet, cloud.ImageID, arvados.Cluster
                return ap.(*ec2InstanceSet), cloud.ImageID(exampleCfg.ImageIDForTestSuite), cluster
        }
        ap := ec2InstanceSet{
-               ec2config:     ec2InstanceSetConfig{},
+               ec2config: ec2InstanceSetConfig{
+                       SpotPriceUpdateInterval: arvados.Duration(time.Hour),
+               },
                instanceSetID: "test123",
                logger:        logrus.StandardLogger(),
                client:        &ec2stub{c: c, reftime: time.Now().UTC()},
index 078dbf494eda04b95bce38a963b06a4365e7292c..f6cf0c91a06681ad7c8ec9574713f6eab82afcf0 100644 (file)
@@ -1397,7 +1397,8 @@ Clusters:
 
           # (ec2) how often to look up spot instance pricing data
           # (only while running spot instances) for the purpose of
-          # calculating container cost estimates.
+          # calculating container cost estimates. A value of 0
+          # disables spot price lookups entirely.
           SpotPriceUpdateInterval: 24h
 
           # (ec2) per-GiB-month cost of EBS volumes. Matches