Skip to content

Commit

Permalink
Replace completeley instance types data when loading config
Browse files Browse the repository at this point in the history
With this commit we replace completely instance types data rather than just update it to make sure data is consistent with the currently loaded configuration.

Additionally we mark instance_types_data parameter's update policy as UNSUPPORTED to avoid changes that may break clusters with sge or torque.

Signed-off-by: ddeidda <[email protected]>
  • Loading branch information
ddeidda committed Mar 18, 2021
1 parent ebc18be commit 566cddf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cli/src/pcluster/config/mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@
"type": JsonCfnParam,
"default": {},
"cfn_param_mapping": "InstanceTypesData",
"update_policy": UpdatePolicy.IGNORED
"update_policy": UpdatePolicy.UNSUPPORTED
}),
]

Expand Down
4 changes: 2 additions & 2 deletions cli/src/pcluster/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ def __init__(self, instance_type_data):
@staticmethod
def load_additional_instance_types_data(instance_types_data):
"""Load additional data to describe instance types."""
InstanceTypeInfo.__additional_instance_types_data.update(instance_types_data)
InstanceTypeInfo.__additional_instance_types_data = instance_types_data if instance_types_data else {}

@staticmethod
def clear_additional_instance_types_data():
Expand Down Expand Up @@ -1353,7 +1353,7 @@ def is_efa_supported(self):

def supported_usage_classes(self):
"""Return the list supported usage classes."""
supported_classes = self.instance_type_data.get("SupportedUsageClasses", [])
supported_classes = list(self.instance_type_data.get("SupportedUsageClasses", []))
if "on-demand" in supported_classes:
# Replace official AWS with internal naming convention
supported_classes.remove("on-demand")
Expand Down

0 comments on commit 566cddf

Please sign in to comment.