From f294fb541a2e2ba3f5fcbd93dbe2dfd57bb99967 Mon Sep 17 00:00:00 2001 From: Sean Smith Date: Thu, 1 Aug 2019 16:50:16 +0200 Subject: [PATCH] Use Placement Group in Dryrun Signed-off-by: Sean Smith --- cli/pcluster/cfnconfig.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/pcluster/cfnconfig.py b/cli/pcluster/cfnconfig.py index 87d83b87ae..4a585dc1e1 100644 --- a/cli/pcluster/cfnconfig.py +++ b/cli/pcluster/cfnconfig.py @@ -360,7 +360,7 @@ def __init_vpc_parameters(self): "VPC section [%s] used in [%s] section is not defined" % (vpc_section, self.__cluster_section) ) - def __check_account_capacity(self): + def __check_account_capacity(self): # noqa: C901 """Try to launch the requested number of instances to verify Account limits.""" if self.parameters.get("Scheduler") == "awsbatch" or self.parameters.get("ClusterType", "ondemand") == "spot": return @@ -387,6 +387,9 @@ def __check_account_capacity(self): MaxCount=max_size, ImageId=test_ami_id, SubnetId=subnet_id, + Placement={"GroupName": self.parameters.get("PlacementGroup")} + if self.parameters.get("PlacementGroup") + else {}, DryRun=True, ) except ClientError as e: @@ -410,6 +413,8 @@ def __check_account_capacity(self): "The configured max size parameter {0} exceeds the number of free private IP addresses " "available in the Compute subnet.\n{1}".format(max_size, message) ) + elif code == "InvalidParameterCombination": + self.__fail(message) else: self.__fail( "Unable to check AWS Account limits. Please double check your cluster configuration.\n%s" % message