Skip to content

Commit fcf30ac

Browse files
Redefine autoscale options
1 parent 5e59c1a commit fcf30ac

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/cdpy/dw.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,14 @@ def delete_cluster(self, cluster_id: str, force: bool = False):
100100
def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template:str = None,
101101
autoscaling_min_cluster:int = None, autoscaling_max_cluster:int = None,
102102
service_config_req:str = None, tags:dict = None):
103-
if all(x is None for x in [autoscaling_min_cluster, autoscaling_max_cluster]):
103+
if autoscaling_min_cluster == 0 and autoscaling_max_cluster == 0:
104104
autoscaling_options = None
105-
else:
106-
autoscaling_options = dict(minClusters=None if autoscaling_min_cluster == 0 else autoscaling_min_cluster,
107-
maxClusters=None if autoscaling_max_cluster == 0 else autoscaling_max_cluster)
105+
elif autoscaling_min_cluster == 0 and autoscaling_max_cluster > 0:
106+
autoscaling_options = dict(maxClusters=autoscaling_max_cluster)
107+
elif autoscaling_min_cluster > 0 and autoscaling_min_cluster == 0:
108+
autoscaling_options = dict(minClusters=autoscaling_max_cluster)
109+
else
110+
autoscaling_options = dict(minClusters=autoscaling_max_cluster, maxClusters=autoscaling_max_cluster)
108111

109112
tag_list = []
110113
for key,value in tags.items():

0 commit comments

Comments
 (0)