Skip to content

Commit 01bc431

Browse files
committed
Update instance pools key and Instance distribution change check (#613)
(cherry picked from commit 9ee1678)
1 parent e97a053 commit 01bc431

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

cli/cmd/lib_cluster_config.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"github.com/cortexlabs/cortex/pkg/lib/errors"
2626
"github.com/cortexlabs/cortex/pkg/lib/prompt"
2727
"github.com/cortexlabs/cortex/pkg/lib/sets/strset"
28-
"github.com/cortexlabs/cortex/pkg/lib/slices"
2928
s "github.com/cortexlabs/cortex/pkg/lib/strings"
3029
"github.com/cortexlabs/cortex/pkg/lib/table"
3130
)
@@ -88,6 +87,11 @@ func getUpdateClusterConfig(cachedClusterConfig *clusterconfig.ClusterConfig, aw
8887
return nil, err
8988
}
9089

90+
err = userClusterConfig.AutoFillSpot()
91+
if err != nil {
92+
return nil, err
93+
}
94+
9195
userClusterConfig.ClusterName = cachedClusterConfig.ClusterName
9296
userClusterConfig.Region = cachedClusterConfig.Region
9397

@@ -115,7 +119,7 @@ func getUpdateClusterConfig(cachedClusterConfig *clusterconfig.ClusterConfig, aw
115119
return nil, clusterconfig.ErrorConfiguredWhenSpotIsNotEnabled(clusterconfig.SpotConfigKey)
116120
}
117121

118-
if slices.StrSliceElementsMatch(userClusterConfig.SpotConfig.InstanceDistribution, cachedClusterConfig.SpotConfig.InstanceDistribution) {
122+
if !strset.New(userClusterConfig.SpotConfig.InstanceDistribution...).IsEqual(strset.New(cachedClusterConfig.SpotConfig.InstanceDistribution...)) {
119123
return nil, errors.Wrap(ErrorConfigCannotBeChangedOnUpdate(clusterconfig.InstanceDistributionKey, cachedClusterConfig.SpotConfig.InstanceDistribution), clusterconfig.SpotConfigKey)
120124
}
121125

docs/cluster/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ spot_config:
6060
max_price: 0.096
6161

6262
# number of spot instance pools across which to allocate spot instances [1, 20] (default: 2)
63-
spot_instance_pools: 2
63+
instance_pools: 2
6464

6565
# docker image paths
6666
image_predictor_serve: cortexlabs/predictor-serve:0.11.0

pkg/lib/clusterconfig/config_key.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const (
2727
OnDemandBaseCapacityKey = "on_demand_base_capacity"
2828
OnDemandPercentageAboveBaseCapacityKey = "on_demand_percentage_above_base_capacity"
2929
MaxPriceKey = "max_price"
30-
InstancePoolsKey = "spot_instance_pools"
30+
InstancePoolsKey = "instance_pools"
3131
ClusterNameKey = "cluster_name"
3232
RegionKey = "region"
3333
BucketKey = "bucket"

0 commit comments

Comments
 (0)